Younger brother, I cannot upload files.-php Tutorial

Source: Internet
Author: User
I cannot upload files. I am trying to upload files. the following error occurs: Warning): failedtoopenstream: NosuchfileordirectoryinE: wwwloginupload. phponline28Warning: mo. I cannot upload files.
When I try to upload a file, an error occurs:
Warning: move_uploaded_file (upload/201006202425103745.png): failed to open stream: No such file or directory in E: \ www \ login \ upload. php on line 28 Warning: move_uploaded_file (): Unable to move 'C: \ WINDOWS \ Temp \ php89.tmp 'to 'upload/201006202379103745.png' in E: \ www \ login \ upload. php on line 28 save picture failed
My code:
If ($ _ SERVER ['request _ method'] = 'post ')
{
If (! Is_uploaded_file ($ _ FILES ['file'] ['tmp _ name'])
{
Echo "fasgsdf ";
Exit;
}

If ($ _ FILES ["file"] ["type"] = "image/gif") |
($ _ FILES ["file"] ["type"] = "image/jpeg") |
($ _ FILES ["file"] ["type"] = "image/jpg") |
($ _ FILES ["file"] ["type"] = "image/gif") |
($ _ FILES ["file"] ["type"] = "image/png") |
($ _ FILES ["file"] ["type"] = "image/bmp ")) & ($ _ FILES ["file"] ["size"] <20000 ))
{
If (file_exists ("upload/". $ _ FILES ["file"] ["name"])
{
Echo "picture already exist ";
}
Else
{
$ Result = move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], "upload/". $ _ FILES ["file"] ["name"]);
If ($ result)
Echo "save picture fuccessful ";
Else
Echo "save picture failed ";
}
}
Else
{
Echo "invalid file ";
Exit;
}
}
?>
Html section:
Script
Function uploadpic ()
{
Var form = document. getElementById ("form1 ");
Form. submit ();
}
Script





------ Solution --------------------
The path is incorrect. There is no upload folder in the current directory, right ??
------ Solution --------------------
Because there is no folder

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.