PHP image downloading error: No permission

Source: Internet
Author: User
Tags php file upload
An error occurred while uploading images in PHP: The Post was last edited by wxg692135346 from 2013-02-0300: 32: 23 in PHP: & lt ;? Phpif & nbsp; ($ _ FILES ["file"] ["type"] & n PHP image upload error: No permission
This post was used to edit the PHP file upload at 00:32:23 on:
 if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . " ";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . " ";
    echo "Type: " . $_FILES["file"]["type"] . " ";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb ";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . " ";

    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?>


The response is:

Warning: move_uploaded_file (upload/12.jpg) [function. move-uploaded-file]: failed to open stream: Permission denied inupload_file.php on line24

Warning: move_uploaded_file () [function. move-uploaded-file]: Unable to move '/saetmp/928/xquer/logs/phppSXyZ6' to 'upload/12.jpg 'inupload_file.php on line24


Google should not have the permission... In linux, the chmod 777 filename method can be used. but in windows, what should I do? Right-click and remove the read-only option of the upload folder. close the window and check whether the attribute is read-only.

What should I do .. (I am using SAE, Sina cloud server, not a local Apache)
------ Solution --------------------
In windows, right-click and choose Properties> Security> Edit> add everyone to check the required permissions.
------ Solution --------------------
Have you set upload_tmp_dir?
If no temporary directory is set, the temporary directory of the operating system will be used, and the Directory of the operating system above XP (excluding XP) is not open to anonymous users.

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.