How do you use is_uploaded_file to check and see if the file has been uploaded or not? I have look at the manual but it hasn't really helped much.
is_uploaded_file
if (is_uploaded_file($HTTP_POST_FILES['user_file'] ['tmp_name'])) {
copy($HTTP_POST_FILES['user_file']['tmp_name'],
$HTTP_POST_FILES['user_file']['name']);
echo "done";
} else {
echo "there is a big problem with the file" . $HTTP_POST_FILES['user_file']['name'];
}
That code doesn't work right for me. When a user goes to upload an zip file, the file goes to 1 directory and the image file goes to another. The image file field is named imagefilename and the zip file field is named zipfilename. There is another field that determines which directory the files are uploaded to. I'm using move_uploaded_file to upload the files to the server. I'm just having problems figureing out how to check if the file has been uploaded or not. Anybody have any ideas?
Thanks
are you blind????
$newZIPname = $HTTP_GET_VARS['dir'] . "whatyouwant.zip";
$newIMAGEname = $HTTP_GET_VARS['dir'] . "what you want";
if (is_uploaded_file($HTTP_POST_FILES['imagefilename']['tmp_name']) && is_uploaded_file($HTTP_POST_FILES['zipfilename']['tmp_name'])) {
copy($HTTP_POST_FILES['zipfilename']['tmp_name'], $newZIPname );
echo "ZIP file uploaded <br>";
copy($HTTP_POST_FILES['imagefilename']['tmp_name'], $newIMAGEname );
echo "IMAGE file uploaded";
} else {
echo "Could not copy the files";
}
is_uploaded_file