Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show image stored outside the public folder in view file - Laravel

I have images in storage/app/uploads/image.jpg, I run command Php artisan storage:link After that in my view file I used this:

img src={{ asset('storage/app/upload/image.jpg') }}

but the image is not showing. I don't want to put my images in public folder. Any help would be highly appreciable.

like image 395
Haris Khan Avatar asked Oct 31 '25 07:10

Haris Khan


1 Answers

If you don't want to store your files inside storage/app/public (which is what the storage:link symlink does), then you need to create a route:

Route::get('show-image', function() {
   $file = storage_path('app/upload/image.jpg');

   return response()->file($file);
})
like image 80
senty Avatar answered Nov 02 '25 03:11

senty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!