Upload image file
| From: | Shaun Thornburgh | Date: | Fri, 01 Nov 2002 21:38:22 +0000 |
| Subject: | Upload image file | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-16678@lists.php.net to get a copy of this message | ||
I am attempting to upload image files to the server from a users browser
using the following code, however, the images seem to get corrupted, they
look completely different and the file sizes are generally smaller, also it
sometimes says file upload unsuccessful, even when it does upload the file?
Any ideas?
Thank you
//copy image to server
if ($image != "none") {
if (copy ($image, $dir.$image_name)){
echo "<p>File upload successful!</p>";
} else {
echo "<p>File upload unsuccessful!</p>";
}
//new name of image
$new_name = "$property_id-$category_id-$sub_category_id.jpg";
//rename the file
rename($dir.$image_name, $dir.$new_name);
}