What\'s a good way to create a unique name for an image that my user is uploading?
I don\'t want to have any duplicates so something like MD5($filename) isn\'t suita
You could take a hash (e.g., md5, sha) of the image data itself. That would help identify duplicate images too (if it was byte-for-byte, the same). But any sufficiently long string of random characters would work.
You can always rig it up in a way that the file name looks like:
/image/0/1/012345678/original-name.jpg
That way the file name looks normal, but it's still unique.