Home > Backend Development > PHP Tutorial > Warning: move_uploaded_file() [function.move-uploaded-file]:_PHP教程

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

WBOY
Release: 2016-07-13 10:54:52
Original
1018 people have browsed it

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

Warning occurred when uploading files today: move_uploaded_file() [function.move-uploaded-file]: Unable to move



Please select the file to upload




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."
";
                 }
                      }else{
echo "Directory path error!";
                 }
            }else{
echo 'The 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:appsTutorialerv-win32-2.5.10AppServwww10index_7.php on line 26

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


The solution is to change the relative path to absolute

$_SERVER[DOCUMENT_ROOT] . '/10/' . $_FILES['fileup']['name'];

Solution
Will
move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"])
Change to
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 like this occurs when uploading. The reason is whether the directory permissions are writable.
Generally, setting 777 can solve the problem. ,
Modify permissions command:

chmod 777 filename
chmod 777 dirname
sudo chmod 777 filename/dirname
chown wgr:admin dirname -R


Note: -R batch execution

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632284.htmlTechArticleWarning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 今天文件上传出现Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move form...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template