Warning: move_uploaded_file () [function. move-uploaded-file]:

Source: Internet
Author: User

Warning: move_uploaded_file () [function. move-uploaded-file]: Unable to move

Warning: move_uploaded_file () [function. move-uploaded-file]: Unable to move

 

<Form action = "" enctype = "multipart/form-data" method = "post">
<Tr>
<Td width = "150" height = "30" align = "right" valign = "middle"> Select Upload File </td>
<Td width = "250"> <input type = "file" name = "fileup"/> </td>
<Td width = "100"> <input type = "submit" name = "submit" value = "Upload"/> </td>
</Tr>
</Form>
<? Php tutorial
If (! Empty ($ _ FILES [fileup] [name]) {
$ Fileinfo = $ _ FILES [fileup];
$ Type = strstr ($ fileinfo ['name'], ".");
If ($ type! = ". Jpg "){
Echo "the format of the file you uploaded is incorrect! ";
} Else {
If ($ fileinfo ['SIZE'] <209715 & $ fileinfo ['SIZE']> 0 ){
$ Path = "10/". $ _ FILES ["fileup"] ["name"];
Move_uploaded_file ($ fileinfo ['tmp _ name'], $ path );
If (is_dir ("10 /")){
$ Dir = scandir ("10 /");
Foreach ($ dir as $ value ){
Echo $ value. "<br/> ";
}
} Else {
Echo "directory path error! ";
}
} Else {
Echo 'file size does not meet the requirements! ';
}
}
}
?>


Running result:
Warning: move_uploaded_file (10/02. jpg) [function. move-uploaded-file]: failed to open stream: No such file or directory in E: apps tutorial erv-win32-2.5.10AppServwww10index_7.php on line 26

Warning: move_uploaded_file () [function. move-uploaded-file]: Unable to move 'C: WINDOWStempphp1A. tmp 'to '2017 .jpg' in E: appserv-win32-2.5.10AppServwww10index_7.php on line 26
Directory path error!


Solution: change the relative path to absolute

$ _ SERVER [DOCUMENT_ROOT]. '/10/'. $ _ FILES ['fileup'] ['name'];

Solution
Set
Move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], "upload/". $ _ FILES ["file"] ["name"])
Change
Move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], "d:/". $ _ FILES ["file"] ["name"])

Method 2

Warning: move_uploaded_file () [function. move-uploaded-file]: Unable to move
An error similar to this occurs during upload because the directory permission is writable.
Generally, you can set 777. ,
Modify permission command:

Chmod 777 filename
Chmod 777 dirname
Sudo chmod 777 filename/dirname
Chown wangr: admin dirname-R


Note:-R batch execution

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.