2014-09-10 3 views
1

Laravel 내 디렉토리에 쓰기.Laravel Wont 작성 디렉토리

오류가 발생합니다.

ErrorException 

Unable to write in the "/var/www/laravel/laravel/public/img/retailer_images/12/" directory (View: /var/www/laravel/laravel/app/views/edit_retailer.blade.php) 

파일 "IMG"

는 우분투에 의해 owend됩니다 : www가 데이터와 내가 뭔가를 간단 말이냐 확신 0777.

의 권한을가집니다.

입력 코드는, (나는 다른 배포 서버에서 작동하기 때문에이 작품을 알고)입니다

if (file_exists ('/img/retailer_images/$retailer_id/banner.png') ) { 
      unlink('/img/product_images/$retailer_id/banner.png');   
     } 
     $file    = Input::file('image'); 
     $extension = Input::file('image')->getClientOriginalExtension(); 
     if($extension=="jpg" || $extension=="jpeg") 
      { 
      $src = imagecreatefromjpeg($file); 
      } 
     else if($extension=="png") 
      { 
      $src = imagecreatefrompng($file); 
      } 
     else 
      { 
      $src = imagecreatefromgif($file); 
      } 
     list($width,$height) = getimagesize($file); 
     $tmp     = imagecreatetruecolor("600","162"); 
     $force_resize  = imagecopyresampled($tmp,$src,0,0,0,0,"600","162", $width, $height); 
     $destinationPath  = public_path().'/img/retailer_images/'.$retailer_id.'/'; 
     $filename   = "banner.png"; 
     $uploadSuccess  = $file->move($destinationPath, $filename); 
     $new_file_dest  = $destinationPath.$filename; 
     DB::table('retailers')->where('id', $retailer_id)->update(array('retailer_img_url' => "http://sniip-kinetic-env-dqcu3vmfku.elasticbeanstalk.com/img/retailer_images/$retailer_id/banner.png")); 
// TO DO add user friendly message here displayed with the image they just uploaded in a thumb size (300 X 300)  
     echo "<img src=/img/retailer_images/$retailer_id/banner.png height=162 width=600> </img><br />"; 
     echo "file uploaded"; 
    } 
+1

'File :: isWritable ('path')' – manix

답변

1

죄송합니다, 의견을 충분히 대표가 없습니다 :

의 앱/저장을 무엇

/logs/laravel.log는 말합니까? 뿐만 아니라/var/logs/-webservername-/error_log?

또한

www가 데이터 에서 아파치/nginx를 실행이 ..

또 다른 일이 있는지 확인하십시오

따옴표 와

('/img/retailer_images/$retailer_id/banner.png') 

을 시도하고이 같은 :

("/img/retailer_images/{$retailer_id}/banner.png") 
+0

을 수행 할 수 있는지 직접 확인하십시오. 더 이상 오류가 없다는 것을 알려주는 로그 정보가 없습니다. – user3750649

+0

은 php.ini에서 로깅 오류가 활성화되었습니다. ? 또한 "debug"= true, laravel app.php에 있습니까? – TrueStory

0

이것은 참된 애매한 문제였습니다. 문제는 파일에 .../img/12/named banner.png 파일에 손상된 데이터가 있었기 때문에 쓰여질 수 없었습니다. (Pems issue) git 저장소에서 그것을 제거한 다음 원격으로 가져 왔습니다. 그때 나는 좋은 'ol F5 키를 눌렀고 모든 것이 완벽하게 작동했습니다. 이것에 대한 도움을 주셔서 감사합니다.