2016-06-12 1 views
0

파일을 옮기고 싶을 때, laravel은 에러를 일으키고, 나는 왜 그런지 이해하지 못합니다. Laravel 5.2 - 파일을 찾을 수 없습니다 (있는 동안);

내가 서버에서 볼 때 나는, 그러나

local.ERROR: exception 'League\Flysystem\FileNotFoundException' with message 'File not found at path: Ad_Pictures/waitinglist/6f6232707e65c7803f7af248a07cb8cesony-z5-familytn videos ad.jpg'

을받는 오류가 그 일 파일 ( 를가 4 일의)

#4

은 여기가 내 파일을 이동하는 데 사용하는 코드

 $newAd = DB::table('ads')->orderBy('created_at', 'desc')->first(); 
     $Ad = Ad::find($newAd->id); 

     $oldDestination_path = "Ad_Pictures/waitinglist/"; 
     $newDestination_path = "Ad_Pictures/".$newAd->id."/"; 

     if(!is_dir($newDestination_path)) 
     { 
      mkdir($newDestination_path); 
     } 
     Storage::move($oldDestination_path.'/'.$file, $newDestination_path.'/'.$file); 

그는 문제없이 새로운 디렉토리를 만들고, 파일을 옮기지 않습니다.

+1

캡쳐 화면이 정확히 표시됩니다 - i 번째 Ad_Pictures/waitinglist 또는/Ad_Pictures /입니까? – herrjeh42

+0

그리고 : 파일 이름에 공백이없는 파일로 동일한 코드를 시도 했습니까? 당신은 결코 알지 못합니다 ... ;-) – herrjeh42

+0

dedtination과 name 변수를 덤프 해 봅시다. laravel은 저장소 폴더에서 lookibg입니다. public foldef에있는 파일을 가지고 있습니다. –

답변

0

전체 코드가 표시되지 않지만 기본적으로 해당 폴더가 저장/응용 프로그램이라는 것을 알려드립니다. 파일이 다른 위치에 있으면 config/filesystems에서 직접 디스크를 만들 수 있습니다. 예 'myDisk' => [ 'driver' => 'local', 'root' =>base_path('xyzFolder'), ],

하고이 파일을 얻을 분명히

use Illuminate\Support\Facades\Storage; 

$data = Storage::disk('myDisk')->get('myFile.txt'); 

처럼 호출 할 수 있습니다 당신이 laravel 워드 프로세서에 따라 다른 기능을 수행 할 수 있습니다.

관련 문제