PHP upload file hint path not found

Source: Internet
Author: User
I rookie just learn PHP want to write an upload image program

$myPicture =$_files[' mypicture '];
Print_r ($myPicture);
$error = $myPicture [' ERROR '];
echo "Error:
";
Switch ($error) {
Case 0://You need to move the temp file to the specified location.
$myPictureName = $myPicture [' name '];
Var_dump ($myPictureName);
echo "
";
$tmp _name= $myPicture [' Tmp_name '];
$destination = "uploads/". $myPictureName;
Echo $destination;
Move_uploaded_file ($tmp _name, $destination);
echo "File upload succeeded";
Break
Case 1:
echo "error number 1th";
Break
Case 2:
echo "error number 2nd";
Break
Case 3:
echo "error number 3rd";
Break
Case 4:
echo "Error number 4th";
Break
Default
echo "Failure";

Here are the error hints:
Warning:move_uploaded_file (uploads/xx.jpg) [Function.move-uploaded-file]: failed to open stream:no such file or Directo Ry in D:\Apache\test\register1.php on line 31

Warning:move_uploaded_file () [Function.move-uploaded-file]: Unable to move ' C:\Windows\Temp\php25F.tmp ' to ' uploads/ Xx.jpg ' in D:\Apache\test\register1.php on line 31


Reply to discussion (solution)

Error two parameters for Move_uploaded_file ()
$destination Write an absolute path test

$destination = "uploads/". $myPictureName;
Change?
$destination =dirname (__file__). " /uploads/". $myPictureName;

??

D:\Apache\test\ ' uploads directory does not exist

Thank you very much or because you didn't create a path. But I tried it on the first and second floor.

??? What's wrong with my knot?

  • 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.