2016-09-20 1 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 = new 업로드; $ content = utf8_encode (File :: get ($ path. "/". $ upload-> file_name)); return $ content;' '$ 경로'를보기로 되돌리고 표시하는 것만! –

+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

일부를 추가하십시오 댓글 및 설명을 코드 스 니펫에 추가하십시오. –

관련 문제