在PHP中移动上传的文件无法正常工作

时间:2016-07-20 16:51:17

标签: php file

move_uploaded_file在PHP中不起作用。 以下是代码

$TempFilePath ='../tmp';
$filename = $custid.$HTTP_POST_FILES['upload']['name'];
if(move_uploaded_file($HTTP_POST_FILES['upload']['tmp_name'], $setTempFilePath .$filename)){
    echo '<br>File Moved <bR>';
    if (file_exists($TempFilePath .$filename)){
        echo '<br> File Exists <br>';
    } else {
        echo '<br> File doesnt Exists <br>';
    }
else {
    echo '<br>File not Moved <bR>';
}

输出是:

File Moved 

File doesnt Exists 

错误:如果文件被移动,那么为什么文件不存在。

1 个答案:

答案 0 :(得分:0)

终于明白了。 https://bugs.php.net/bug.php?id=32644(你知道Apache做了一个内部'cwd /'?)