php文件未上载,错误代码为0

php文件未上载,错误代码为0,php,Php,我正在尝试使用php将文件上载到与上载脚本不在同一目录中的目录,下面是dir的结构: var>www>html> foo>index.php //this ones where upload is done bar> //this is where I want to upload it index.php文件的表单元素: 错误日志: [Wed Sep 23 14:10:46.841250 2015

我正在尝试使用php将文件上载到与上载脚本不在同一目录中的目录,下面是dir的结构:

var>www>html>
            foo>index.php //this ones where upload is done
            bar>          //this is where I want to upload it
index.php文件的表单元素:

错误日志:

[Wed Sep 23 14:10:46.841250 2015] [:error] [pid 4028] [client 78.167.168.253:52438] PHP Warning:  move_uploaded_file(): Unable to move '/tmp/phpEB1a3s' to '/var/www/html/eShop/Capture.PNG' in /var/www/html/ftp/index.php on line 16, referer: http://xxx.xx.xx.xx/ftp/index.php

还要检查文件名是否有效,并记住警告:

警告:如果目标文件已经存在,它将被覆盖

建议始终检查以下各项:

isset$\u FILES[FileInput]&&$\u FILES[FileInput][error]==上传\u ERR\u确定


在继续之前为true。

检查此链接:@saurabh2836;响应状态是什么?失败还是成功?检查服务器机器上的php日志,确保没有错误。另外,您也可以发布index.php表单吗?最后,我建议使用isset$\u FILES[submit]&&$\u FILES[submit][error]==UPLOAD\u ERR\u OK。@Bonatti现在添加了其余的代码,应该可以更清楚地了解我想要得到什么done@mrahmat在ifmove\u上载\u文件之前。。。函数,回显$upload_路径并在问题中发布。我想你可能没有写权限。默认情况下,大多数服务器只能读取www及以下内容。GetCwds应该在那之外。。。也要检查它下面的echo __;文件的结果
if(isset($_POST['upload'])){
            $upload_path = $_POST['subDirList'];
            if($upload_path == ''){
                $upload_path = $_POST['dirList'];
            }
            $upload_path = getcwd().'/'.$upload_path;
            $upload_path = $upload_path.'/'.basename($_FILES['filePath']['name']);              
            if(move_uploaded_file($_FILES["filePath"]["tmp_name"], $upload_path)){
                echo "success";
            } else {
                echo print_r($_FILES);
                echo 'fail';
            }

        }
[Wed Sep 23 14:10:46.841250 2015] [:error] [pid 4028] [client 78.167.168.253:52438] PHP Warning:  move_uploaded_file(): Unable to move '/tmp/phpEB1a3s' to '/var/www/html/eShop/Capture.PNG' in /var/www/html/ftp/index.php on line 16, referer: http://xxx.xx.xx.xx/ftp/index.php