Have you done a symlink yet?
Nov 23, 2021
8
Level 1
image does not display in laravel v8
When I want to upload images to my Laravel project, they are placed in a database and storage\app\articles file, but I can't display them.
how can I fix it?
here is my code:
this is create.blade.php:
<div class="mb-3">
<label for="image">image</label>
<input type="file" class="form-control" name="image" id="image">
</div>
And this is show.blade.php:
<td>
<img src="{{url('/storage/'.$article->image)}}" width="120px" height="60px" alt="">
</td>
and this is my postsController:
public function store(CreateArticleRequest $request)
{
$image=$request->image->store('articles');
//create the post
$article=Article::create([
'title'=>$request->title,
'description'=>$request->description,
'content'=>$request->content,
'image' => $image,
'published_at' => $request->published_at,
'category_id' => $request->category,
//'user_id' => auth()->user()->id
]);
if ($request->tags) {
$article->tags()->attach($request->tags);
}
//fetch the massage
session()->flash('success','Post Created Successfully');
//redirect user
return redirect(route('cms.index'));
}
Level 1
i found the Solution: https://stackoverflow.com/questions/64096668/laravel-8-image-not-showing
thanks guys 🙏🙏🌹
1 like
Please or to participate in this conversation.