MySQL Forums
Forum List  »  PHP

problem with changing image name
Posted by: tom liu
Date: February 24, 2006 12:02AM

I want to write a php file to let user upload image. But i am afraid that they will upload the image with same name. So the new one will overwrite the old one. I want to add time for each image name(i.e. test2000-1-1.gif). What shall i do? Many thanks in advance.
Below is source code.

if ($_FILES['imagefile']['type'] == "image/pjpeg"||"image/gif"){
copy($_FILES['imagefile']['tmp_name'], "C:/apache/htdocs/upload/image/".$_FILES['imagefile']['name'])
or die ("Could not copy");
echo "Thanks";

}
else {
echo "<br><br>";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>";
}

Options: ReplyQuote


Subject
Written By
Posted
problem with changing image name
February 24, 2006 12:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.