Ivan-Tshimanga's avatar

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

0 likes
1 reply

Please or to participate in this conversation.