PHP code
if ($_files[' my_file ' [' Error '] > 0) {
echo "wrong". $_files[' my_file ' [' Error '];
}else{
if ($_files["My_file" ["Tmp_name"]) {
echo "name =". $_files["My_file" ["Tmp_name"];
echo "name2 =". " img/". $_files[" My_file "[" Name "];
if (Move_uploaded_file ($_files["My_file" ["Tmp_name"], "/img/". $_files["My_file" ["Name"])) {
echo "Success";
}else{
echo "Failure";
}
}
}
When uploading a file, the prompt fails.
Upload results:
Name = C:\\windows\\temp\\php595e.tmp Name2 = img/634914612464629528.jpg failed
------Solution--------------------
if (Move_uploaded_file ($_files["My_file" ["Tmp_name"], " /img/". $_files["My_file" ["Name"])) {
How did it become an absolute path?
------Solution--------------------
Estimated to be a path problem, turn on the error hints feature to see.
------Solution--------------------
is the entire folder writable?
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.