1
I have a problem when I try to upload an image, well, when I give Submit in the form it returns the following error:
Intervention\Image\Exception\NotWritableException
Can't write image data to path (public/images/products/2014-06-01-16:24:38-581165_571926502843010_889453779_n.jpg)
Well, I figured it might be permission issue, so I went over there and gave permission 777 in the directory, but the bastard keeps making the same mistake. Just follow my code:
public function postCreate(){
$validator = Validator::make(Input::all(),Product::$rules);
if($validator->passes()){
$product = new Product();
$product->category_id = Input::get('category_id');
$product->title = Input::get('title');
$product->description = Input::get('description');
$product->price = Input::get('price');
$product->availability = Input::get('availability');
$image = Input::file('image');
$filename = date('Y-m-d-H:i:s').'-'.$image->getClientOriginalName();
Image::make($image->getRealPath())->resize('468,249')->save('public/images/products/'.$filename);
$product->image = 'images/products/'.$filename;
$product->save();
return Redirect::to('admin/products/index')
->with('message','Produto cadastrado');
}
}
Can’t you provide a more verbose error message? It’s just that this error message is too wide. It can give room for a lot of things.
– Wakim