Ivan-Tshimanga's avatar

Howto upload images to public_html/domain instead of local public

Hi All I build app on local, It is working fine, when I upload it to Godaddy public_html, everything is working perfect instead of the script for upload images to public, This is errors message, I got

(1/1) NotWritableException Can't write image data to path (/home/congohost/Lara/public_html/images/1500405217.jpg)

my controller script is

    $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);
}
0 likes
3 replies
Snapey's avatar

The clue is in the error message. You don't have rights to write to the public folder. Fix the permissions and your problem will be resolved.

Ivan-Tshimanga's avatar

how I can change that permission, like this chmod -R 777 /images please help

jlrdw's avatar

There are already so many previous post on proper installation of laravel that a search should do the trick. Myself and others has answered this question dozens of times.

Please or to participate in this conversation.