Wisdomugo1's avatar

Unable to access and display image i uploaded to the storage folder

Greetings, I uploaded image to the storage/services folder of my laravel5.4 app. The code that stored it:

$image = request()->file('image'); $ext = $image->guessClientExtension(); $filename = '_'.$service->id.$title.'.'.$ext; $image->storeAs('public/services/', $filename); it went through cos I can see it when I navigate to the folder.

I have tried the following ways to access it: created a symlink thus: php artisan storage:link img src="{{ url('storage/images/'.$article->image) }}" alt="" title="" /> but it didn't work. what did I not do right?

Pls I need help. Thank you.

0 likes
5 replies
Helmchen's avatar

you saved it to public/services and you try to access it on storage/images

Wisdomugo1's avatar

sorry, that was a mistake, a previous markup. currently, even before asking this question i try to access it this way: img src="{{ url('storage/services/'.$article->image) }}" alt="" title="" />

Nash's avatar

The public disk / local driver stores the files in storage/app/public. So storage/app/public/services/image.jpg would become asset('storage/services/image.jpg') in your view and you would store it with storeAs('services', 'image.jpg')

Please or to participate in this conversation.