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] & nbsp; imagegif) | & nbsp; ($ _ FILES [file] [typ PHP Upload image error: No permission
This post was last edited by wxg6900005346 at 00:32:23 on
Small case of PHP file upload:
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.