移动成功上传的文件时出现问题

时间:2016-11-03 09:12:45

标签: php laravel laravel-5.2

请在下面找到编码部分, 您可以根据解释提供输入。

public function upload(Request $request)
{
    $content = $_POST['code'];
    if (Storage::exists('file.blade.php'))
    {
        echo "File is already exists..............";
    }
    else
    {
        Storage::disk('local')->put('file.blade.php', $content);
        echo "uploaded successfully..........."; 


        $fileName = "file.blade.php";
        $oldPath = "/storage/app/file.blade.php";
        $destinationPath = "/resources/views";


        File::move($oldPath, $destinationPath);

    }

}

我使用上面的代码试图移动文件。但是我收到以下错误消息。

  

Filesystem.php第176行中的ErrorException:   重命名(/storage/app/file.blade.php,/resources/views):系统   找不到指定的路径。 (代码:3)

1 个答案:

答案 0 :(得分:0)

尝试改变如下:

$fileName = "file.blade.php";
$oldPath = "/storage/app/file.blade.php";
//$destinationPath = "/resources/views"."$fileName";
$destinationPath = "/resources/views/"."$fileName";