The move_uploaded_f ile() function is very quirky. I want to allow
users to upload images to the Web site. Here is the code:
if(!move_upload ed_file($_FILES['tempimagefile']['tmp_name'],
$imagefile))
{
die("Could not move file: ".$_FILES['tempimagefile']['tmp_name']."
-> $imagefile");
} else {
enter record into database...
...
...
}
The record is added to the database, so I have to assume that the
move_uploaded_f ile() function returned a positive result. Elsewhere in
the Web site I have a function that displays the image. The
getimagesize() function is used to determine the image dimensions. I
get an error message when the move_uploaded_f ile() function had
corrupted the file upload:
Warning: getimagesize(): Read error! ...
Could not get size of: imagename.gif
The file exists but its size is 0 bytes. Somehow the image data is
non-existent. Only an empty file with the correct file name is
present. This causes the getimagesize() function to spew out that
error message. Is this a known issue with the move_uploaded_f ile()
function? I've read somewhere else that using the copy() function
results in the same thing - a corrupt file. Does anyone know why this
is happening? Is there any way to fix this problem? Thanks.
users to upload images to the Web site. Here is the code:
if(!move_upload ed_file($_FILES['tempimagefile']['tmp_name'],
$imagefile))
{
die("Could not move file: ".$_FILES['tempimagefile']['tmp_name']."
-> $imagefile");
} else {
enter record into database...
...
...
}
The record is added to the database, so I have to assume that the
move_uploaded_f ile() function returned a positive result. Elsewhere in
the Web site I have a function that displays the image. The
getimagesize() function is used to determine the image dimensions. I
get an error message when the move_uploaded_f ile() function had
corrupted the file upload:
Warning: getimagesize(): Read error! ...
Could not get size of: imagename.gif
The file exists but its size is 0 bytes. Somehow the image data is
non-existent. Only an empty file with the correct file name is
present. This causes the getimagesize() function to spew out that
error message. Is this a known issue with the move_uploaded_f ile()
function? I've read somewhere else that using the copy() function
results in the same thing - a corrupt file. Does anyone know why this
is happening? Is there any way to fix this problem? Thanks.
Comment