Hello,
My problem: I have a script to upload a file. The file is uploaded (error = 0), the file is visible and present in my server's images directory, but the file is not usable. So in my webpage the file images/file.jpg is not usable.
Does anybody have an idea why this could be ? Any help appreciated.
//Upload the file
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
echo "Uploading " . $_FILES["file"]["name"];
echo " (" . $_FILES["file"]["type"] . ", ";
echo ceil($_FILES["file"]["size"] / 1024) . " Kb).<br />";
$uploaddir = '/www/w/whatever/htdocs/images/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
echo $uploaddir;
if (file_exists("uploads/" . $_FILES["file"]["name"])) {
echo $_FILES["file"]["name"] . " already exists. ";
echo "Please delete the destination file and try again.";
} else {
move_uploaded_file($_FILES["file"]["tmp_name"],$uploadfile);
echo "File has been stored in your uploads directory.";
}
Many thanks,
Michel