Upload/Rename Script
am 27.01.2008 04:39:16 von Fred AtkinsonHere's what I want to do:
There will be a Web page with a form and submit button that
executes a PHP script to perform the upload and then put up a page
with either a success or failure message.
I want to locate and existing or create a new PHP script that
will allow a file to be uploaded to a specific directory on a Web site
and rename it after the upload. I also want to incorporate some kind
of protection so that a file uploaded with the same name does not
overwrite a previously uploaded file (maybe put filename_1,
filename_2, etc. on subsequent uploads).
For the former, is there any way to upload it with a different
filename than on the client's machine (other than using the rename
command)? Example: filename is: thisfile.jpg. Have a browse button
to retrieve the file and a text line with another name (bill) and have
it upload as bill.jpg (or bill_1.jpg if a bill.jpg already exists)?
For the latter, I have a couple of ideas of how to code that.
But I wanted to see if there were any suggestions that there might be
a better way.
I would be grateful for any suggestions.
Regards,
Fred