While disk space is cheap, dealing with large numbers of files can be tedious, and in some cases unnecessary. Before considering file naming conventions, consider the uniqueness of your files. At work, we allow our customers to upload logos. It’s possible for multiple customers to upload the same logo. The last thing we wanted was to maintain multiple copies of the same logo on the server.
$filename = md5(file_get_contents($pathToFile));
What naming conventions do you use for user uploaded files? This method seems like it would work well for any uploaded files because nothing would ever be the same. Do you agree or disagree? Why?