View Full Version : Why should you change the name of the image uploaded?
jnscollier
05-28-2007, 09:18 PM
Hey all,
I recently found a script that works great for allowing users to upload pictures. It changes the uploaded file name though... here's the script:
http://www.reconn.us/file_uploading.html
I'm just curious why is this helpful or needed? Is this a good thing or a bad thing or does it even matter?
Just curious.
-Sammy :eek:
thetestingsite
05-28-2007, 09:47 PM
It mostly depends on the use of the code. If you are using it for a forum (or even an image hosting site), it would be wise to append to the file name something like the unix timestamp or a random hash. This is mainly due to the possiblity of users uploading the same image mulitple times (without knowing it).
Hope this helps.
djr33
05-28-2007, 10:54 PM
Well, you should check for duplicates in many cases and just only keep one, but link to that same file for both additions to the system, if needed. This depends on your use of an image uploader, though.
Changing the filename prevents duplicate names of even different pictures, like "pic1.jpg" which could be ANYTHING, and likely will overlap, given enough users.
Also, changing the name of uploaded files can help in security, in case someone uploads a script that is dangerous, they can't find it so easily. However, this isn't the only protection that is needed, and doesn't apply if you are only doing images.
jnscollier
05-29-2007, 12:47 AM
Yeah, i totally didn't think of some of those things... thanks for answering my question!
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.