File upload error solution

Source: Internet
Author: User
File upload error: This post was last edited by sspghost from 2014-01-2117:23:00. if some files are uploaded, an error is reported, for example, Warning: & nbsp; move_uploaded_file (D: /xampp/htdocs/ca file upload error
This post was last edited by sspghost at 17:23:00. if some files are uploaded, an error will be reported, for example, Warning: move_uploaded_file (D:/xampp/htdocs/ca/doc/new .txt): failed to open stream: Invalid argument in D: \ xampp \ htdocs \ ca \ do_upload.php on line 22

Warning: move_uploaded_file (): Unable to move 'd: \ xampp \ tmp \ php3BF8. tmp 'to 'D:/xampp/htdocs/ca/doc/new .txt' in D: \ xampp \ htdocs \ ca \ do_upload.php on line 22
Stored in: D:/xampp/htdocs/ca/doc/new. txt line22 is the 13th line of the following code.
If you change the txt name to a new text document, there is no problem... why?
 if ($_FILES["upload_file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["upload_file"]["error"] . " ";
    }
  else
    {
    echo "Upload: " . $_FILES["upload_file"]["name"] . " ";
    echo "Type: " . $_FILES["upload_file"]["type"] . " ";
    echo "Size: " . ($_FILES["upload_file"]["size"] / 1024/1024) . " MB ";
    echo "Temp file: " . $_FILES["upload_file"]["tmp_name"] . " ";

      move_uploaded_file($_FILES["upload_file"]["tmp_name"],
      "D:/xampp/htdocs/ca/doc/" . $_FILES["upload_file"]["name"]);
      echo "Stored in: " . "D:/xampp/htdocs/ca/doc/" . $_FILES["upload_file"]["name"];
    }
$name=$_FILES["upload_file"]["name"];
$size=floor($_FILES["upload_file"]["size"] / 1024/1024 )."MB";
$loc="doc/" . $_FILES["upload_file"]["name"];
echo "
";
?>
Share: More

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.