PHP Construct Unique File Names | |
Unique Filenames in PHPThe PHP function presented below creates a unique filename based on a random string of characters plus the Unix timestamp. The chances of the filename not being unique are a very respectable one in 308,915,776 ! The function takes a prefix and an extension. this allows the same name creation routine to be used for a number of different purposes, allowing a housekeeping routine to dlete files based on an expiry date (see php process all files in a directory for an example.
was constructed in PHP by the function below when called as uniquename('lmx','txt') Reload the page and you should see another set!
You will note that the software also adds a dash X (-X) into the filename. This makes it easy to retrieve the files timestamp from the filename by using explode('-',$filename) alittle practical twist. Hopefully you will find this sample code useful, feel free to use any of our code snippets on your site it has been placed in a text box to make cut and paste easier. A link back to www.webmaster-a.com would be appreciated.!
|
Useful Pages
PHP Unique Filename Referrersbookmark hitwww.google.com www.google.co.uk www.google.fr www.google.com.sg www.google.ee www.google.ca www.google.com.ph www.google.co.za www.google.com.br www.google.co.in www.google.nl www.google.pl www.google.de translate.google.fr internal hit www.google.rs www.google.com.ua www.google.it www.google.com.hk www.google.bg www.google.co.il www.bing.com denvang.com baerbykes.com www.google.co.ke www.google.sk ... ... www.google.si www.google.lv ... www.google.se www.google.hu www.google.at www.google.com.ar expertpen.com www.google.lt 022tv550.info www.google.co.th www.google.fi ... www.google.co.nz yandex.ru fahsairiverview.com This list of people who link to this PHP Code Snippet page is automagically maintained. Link to us, send traffic, and get listed. Simple. |