无法将文件上传到文件夹

时间:2016-05-06 08:58:38

标签: php html5

我无法将文件上传到文件夹中。

URL = 'http://localhost/ezy_mvc/';

$newFilePath = URL."public/uploads";

I tried using relative url instead of http:// like = ../../public/uploads     

数据结构:
enter image description here

我正在使用MVC框架。因此我有控制器,模型和视图。

控制器:

 function upload()
        {
            $this->model->upload();
        }

型号:

function upload()
    {
        // Count # of uploaded files in array
        $total = count($_FILES['files']['name']);

        // Loop through each file
        for($i=0; $i<$total; $i++) {
        //Get the temp file path
        $tmpFilePath = $_FILES['files']['tmp_name'][$i];

        //Make sure we have a filepath
        if ($tmpFilePath != ""){
        //Setup our new file path
        //$newFilePath = "./uploadFiles/" . $_FILES['files']['name'][$i];
        $newFilePath = URL."public/uploads";
        //Upload the file into the temp dir
        move_uploaded_file($tmpFilePath, $newFilePath);
        /*if(move_uploaded_file($tmpFilePath, $newFilePath)) {
        //Handle other code here
        }*/
        }
       }
    }

错误(警告):

Warning: move_uploaded_file(http://localhost/ezy_mvc/public/uploads): failed to open stream: HTTP wrapper does not support writeable connections in C:\wamp\www\ezy_mvc\models\product_model.php on line 24

Warning: move_uploaded_file(): Unable to move 'C:\wamp\tmp\php50B6.tmp' to 'http://localhost/ezy_mvc/public/uploads' in C:\wamp\www\ezy_mvc\models\product_model.php on line 24

0 个答案:

没有答案