You might need to update your laravel public folder path https://laracasts.com/discuss/channels/general-discussion/where-do-you-set-public-directory-laravel-5
Jul 18, 2017
1
Level 1
Can't write image data to path
hi All Please I need help I am new on laravel, I was created app, on local computer, it was working fine. when I upload it at Godaddy on my cpanel, I move my website folder on root, I named Laravelwesite and I move all content that were on public on local to public_html.
Now when I try to upload image to website I got this is Can't write image data to path
here is my controller code
// Store in the database $posts = new Post; /******* //Store image on system $image = $request->file('image'); $filename = $image->getClientOriginalName(); Storage::put('upload/images' .$filename, file_get_contents($request->file('image')->getRealPath())); *********/
$posts->title = $request->title;
$posts->slug = $request->slug;
$posts->body = $request->body;
//Save our image
if($request->hasFile('featured_image')){
$image = $request->file('featured_image');
$filename = time(). '.' . $image->getClientOriginalExtension();
$location = public_path('images/' . $filename);
Image::make($image)->resize(800, 500)->save($location);
$posts->image = $filename;
}
$posts->save();
Session::flash('success', 'The Message was successfully Post!');
return redirect()->route('posts.show', $posts->id);
}
what I must do to display my images
Please or to participate in this conversation.