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