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

Here's the code

if(copy($userfile, "/ez/codesnipits/temprotatingimages/newimage.jpg")){
print "Your photo has been uploaded successfully.<br>" ;
}
else
{
print "No luck with the upload dude.<br>";
}


print "Size of Image in Bytes: " . $userfile_size . "<BR>";
print "Image Type: " . $userfile_type . "<BR>";

if(file_exists($userfile)){
print "File exists on server.<br>";

 grab newly added filename from directory on server
$filename =  $userfile;


rename file
$newfilename = "/rotatingimages/" . $filename;
print $newfilename;

}
else
{
print "File doesn't exist on server.<br>";
}

?>


Thx a bunch, Joe:)



-- 
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