Hello everyone!
I have a question. I have a form that the user can use to upload their image files to a server. Which works fine.
What I failed to discover before was what if someone uploads a file that happens to have the same name that's already in the upload directory on the server?
I'm trying to avoid these files from being overwritten in the directory because they may have the same file name.
I'd rather avoid use the file exist() function due to the excessive usage of memory.
What I would like to do instead is have php attach a random ID to the begining of the file name.
(ie 'image.gif changed to r3j2image.gif)
Simply let the random function add this to the file name before it is uploaded. I guess what I'm doing is renaming the file.
This way the files are less likely to be overwritten in the directory.
Any suggestions?
Thanks
KJ
I have a question. I have a form that the user can use to upload their image files to a server. Which works fine.
What I failed to discover before was what if someone uploads a file that happens to have the same name that's already in the upload directory on the server?
I'm trying to avoid these files from being overwritten in the directory because they may have the same file name.
I'd rather avoid use the file exist() function due to the excessive usage of memory.
What I would like to do instead is have php attach a random ID to the begining of the file name.
(ie 'image.gif changed to r3j2image.gif)
Simply let the random function add this to the file name before it is uploaded. I guess what I'm doing is renaming the file.
This way the files are less likely to be overwritten in the directory.
Any suggestions?
Thanks
KJ