2016-09-20 11 views
0

アップロードされたファイルをシステムに読み込もうとしていますが、毎回読み込むことができないため、エラーFileNotFoundException in Filesystem.php line 41: File does not exist at path /var/www/html/..私は何が間違っているのか分かりません。私はFile::get()メソッドを使用しています。以下はコードです。助けてくれてありがとうFilesystem.phpのFileNotFoundException行41:ファイルがパスに存在しません(LARAVEL)

public function getUploadedFile() { 

    $destinationPath = 'uploads'; 
    $path= public_path()."/". $destinationPath; 

    echo $path; // this was to check whether am I getting the right path or not which I am getting. 

    $upload = new Upload; 
    $content = utf8_encode(File::get($path ."/". $upload->file_name)); 
    return $content; 
} 
+0

は、ファイルのパーミッションは644で、フォルダのアクセス許可は一度も一度フル提供077.checkですファイルのパスとチェック –

+0

なぜこれを行うのですか? '$ upload =新しいアップロード; $ content = utf8_encode(File :: get($ path。 "/"。$ upload-> file_name)); return $ content; ' ' $ path'をビューに戻して表示するだけではどうですか? –

+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', 
    ], 

], 
+1

いくつかを追加してください。コメントと説明をコードスニペットに追加します。 –

関連する問題