Joe Van Meer wrote:

> Hi there, I have an upload form on my website that works great, however I
> have come to a roadblock...how the heck do I rename the copied file?
> Everytime I upload an image it overwrites the old one with the new. The
> code below uploads the file and displays the following:
> 
> Your photo has been uploaded successfully.
> Size of Image in Bytes: 36315
> Image Type: image/pjpeg
> File exists on server.
> /rotatingimages/C:\PHP\uploadtemp\php12D.tmp   <-- I notice that this is a
> temporary name

If two files were being uploaded at once, you'd get two different names...

But it's entirely up to *YOU* to decide where to copy the file to.  Maybe 
you'd *WANT* to replace files as they were uploaded.

I tend to use the user's filename and preg_replace() to get rid of 
everything except a-zA-Z._-  and then checking where I'm copying to tack on 
1, 2, 3, ... until I find a new filename that's not in use.

You should also start using http://php.net/move_uploaded_file instead of 
copy or whatever you are doing.

-- 
Like music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to