If I make the filename of each uploaded file PHPs microtime(), are the risks of a collision realistic? And is there a way to further randomize the filenames?
I’m expecting about 20,000 uploads in about a week. That’s 2800/day or 119/hour (assuming even distribution). Does anyone have any experience with assuming microtime to be unique?
Thanks!
The best way to generate random file names in your case is to use GUIDs. They are great because this algorithm guarantees uniqness of the value even for multiple server. If you are using windows the
com_create_guidfunction is for you.Also you can look at
uniqidfunction which available for all PHP platforms.