Filesystem.php第41行中的FileNotFoundException:路径中不存在文件(LARAVEL)

时间:2016-09-20 14:07:54

标签: php laravel file-upload laravel-5.2 filereader

我正在尝试将上传的文件读到我的系统,但我无法阅读它,因为每次我这样做都会收到此错误/proc/cpu/alignment我不知道我在做错了什么。我正在使用FileNotFoundException in Filesystem.php line 41: File does not exist at path /var/www/html/..方法。下面是代码。谢谢你的帮助

File::get()

1 个答案:

答案 0 :(得分:0)

型号

public function setFileAttribute($file){
$this->attributes['file'] = Carbon::now()->second.$file->getClientOriginalName();
$name = Carbon::now()->second.$file->getClientOriginalName(); 
\Storage::disk('local')->put($name, \File::get($file));
    }

<强> fileSystems.php

   'disks' => [

    'local' => [
        'driver' => 'local',
       // 'root' => storage_path('public'),
        'root' => public_path('storage'),
    ],

    'public' => [
        'driver' => 'local',
        'root' => storage_path('storage'),
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key' => 'your-key',
        'secret' => 'your-secret',
        'region' => 'your-region',
        'bucket' => 'your-bucket',
    ],

],