移动上传文件在Windows服务器上不起作用?

时间:2015-10-29 05:04:12

标签: php windows

我有一些问题要将文件从php上传到Windows Live服务器而不是Linux。 move uploaded file同样我使用copy移动上传文件的插件,但这不起作用。

当我在现场设置此代码时,整个代码在本地计算机上工作正常然后给我警告而不上传文件夹中的任何文件...

给我一些帮助

这是我的整个代码

error_reporting(E_ALL); 
ini_set("display_errors", 1);  

        //$uploads_dir = '/uploads';
        $uploaddir = $_SERVER['DOCUMENT_ROOT']."/img/customer_image/";
    $uploadfile = $uploaddir . basename($_FILES['customer_image']['name']);

    echo "<p>";

    if ( (copy($_FILES['customer_image']['tmp_name'], $uploadfile))) {
      echo "File is valid, and was successfully uploaded.\n";
    } else {
       echo "Upload failed";
    }

    echo "</p>";
    echo '<pre>';
    echo 'Here is some more debugging info:';
    print_r($_FILES);
    print "</pre>";

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

$dir= $_SERVER['DOCUMENT_ROOT']."/img/customer_image/";
if (move_uploaded_file($_FILES['customer_image']['tmp_name'], $dir. $_FILES["customer_image"]['name'])) {
    echo "Uploaded";
} else {
   echo "File was not uploaded";
}

在Windows中设置文件夹权限

  

1.右键单击文件夹,然后单击属性

     

2.点击安全标签

     

3.选择组或用户名,然后单击编辑按钮

enter image description here

  

4.如果任何一个被标记为拒绝,请检查权限,然后取消选中

     

5.点击“确定”