How to access image from storage sub folder in Laravel 8

Viewed 1213

How to get image url with mimeType in laravel 8 from Storage sub folder.

My Folder look like this :

enter image description here

I want to access this image marked in red, So I did these steps:

Step 1 : Create Link using ** php artisan storage:link **

Then In my Controller :

$exists =  Storage::disk('public')->get('/app/media/HRTKD1607258351/HRTKD1607258351');
    if($exists) {
        return "File Found";
    }else{
        return "File Not Found";
    }

But I am getting File Not Found Error.

Can somebody help me?

Thanks in advance.

2 Answers

Try this:

Storage::disk('media')->url('HRTKD1607258351/HRTKD1607258351.jpg');

Specify the port that the application is using.

e.g set app url in .env to APP_URL=http://localhost:8000

Related