Do a picture upload function, always prompt two lines of exception
Source: Internet
Author: User
Do a picture upload function, always prompt two lines of error.
Do a picture upload function, always prompt two lines of error:
notice:undefined index:upload in D:\WWW\qiangyuan\up.php on line 34
notice:undefined index:upload in D:\WWW\qiangyuan\up.php on line 41
The code is as follows:
/**
* $file _ext: Upload the file image format;
* $file _name: After uploading, there is a new path and file name on the server;
*/
Echo substr ($file _name,2);//output generated picture name
echo "
";
echo "";
}
Else
{
echo "Upload file image size must be less than 400kb";
}
}
Else
{
echo "uploaded file format is incorrect";
}
}
?>
------Solution--------------------
discuss
Do a picture upload function, always prompt two lines of error:
notice:undefined index:upload in D:\WWW\qiangyuan\up.php on line 34
notice:undefined index:upload in D:\WWW\qiangyuan\up.php on line 41
The code is as follows:
------Solution--------------------
Judge $_files[' upload ' [' error '] = = ' 0 ' to see if it has been uploaded to PHP.
You can also print_r before using $_files ($_files); View the parameters.
------Solution--------------------
Explore
To determine whether the form has been submitted, if there are files uploaded and then processed:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.