Call move_uploaded_file function hint in PHP failed to open stream and unable to move

Source: Internet
Author: User
Tags php file upload

In a php file upload system, the use of move_uploaded_file file upload, prompted the following two warning, can not upload files successfully

Warning: Move_uploaded_file (upload/songshu_rgb.gif) [Function.move-uploaded-file]: failed to open Stream:no Such file or directory in D:\www\2737\upload_file.phpon line

Warning: Move_uploaded_file () [Function.move-uploaded-file]: Unable to move ' C:\WINDOWS\Temp\php80.tmp ' to ' Upload/songshu_rgb.gif ' in D:\www\2737\upload_file.php
Stored In:upload/songshu_rgb.gif

Previously considered to be insufficient directory permissions, after looking for information, in fact, is the reason why the file is not found, how to solve it? Find data find, should use absolute path instead of relative path, the original code is as follows

Move_uploaded_file ($_files["file"] ["Tmp_name"],
"upload/" . $_files["File" ["name"]);
echo "Stored in:". " Upload/". $_files["File" ["Name"];

After modification:

Move_uploaded_file ($_files["file"] ["Tmp_name"],
"d:/www/2737/upload/" . $_files["File" ["name"]);
echo "Stored in:". " Upload/". $_files["File" ["Name"];

Note the highlight section.

There is a way to modify permissions, change the permissions to 777 can be, more trouble, we can find the following article to see.

Http://www.360doc.com/content/12/1023/17/7851074_243314218.shtml

Call move_uploaded_file function hint in PHP failed to open stream and unable to move

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.