php - Laravel Wont Write to Directory -
laravel wont write directory.
the error is.
errorexception unable write in "/var/www/laravel/laravel/public/img/retailer_images/12/" directory (view: /var/www/laravel/laravel/app/views/edit_retailer.blade.php) the file "img" owend ubuntu:www-data , has permissions of 0777.
i sure missing simple.
the input code is, (i know works works on other deployed servers)
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")); // add user friendly message here displayed image uploaded in thumb size (300 x 300) echo "<img src=/img/retailer_images/$retailer_id/banner.png height=162 width=600> </img><br />"; echo "file uploaded"; }
sorry, don't have enough rep comment:
what app/storage/logs/laravel.log say? /var/logs/-webservername-/error_log ?
also make sure apache/nginx runs under www-data ..
another thing:
try
('/img/retailer_images/$retailer_id/banner.png') with double quotes , this:
("/img/retailer_images/{$retailer_id}/banner.png")
Comments
Post a Comment