Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nhayder's avatar
Level 13

How to access files and image stored outside public folder

im storing files and images in cloudfolder stored outside public folder but not sure how to access these files from blade and vue component ???

folder exists on /MyApp/storage/app/cloudfolder

any ideas

0 likes
3 replies
bobbybouwmann's avatar
Level 88

You can't indeed access them from there. So you should either use an endpoint for that to get to those images. Just like my previous reply you can use that same url to access that file in your views or components.

Let me know if you need an example!

1 like
nhayder's avatar
Level 13

thank you for your support, i will work on this and let you know what happened

Thanks man.

nhayder's avatar
Level 13

@bobbybouwmann hey, just to update you, i got it working this time by making an endpoint to return the filename

Route::get('/images/{file}', [ function ($file) {

    $path = storage_path('app/cloudfolder/images/'.$file);

    if (file_exists($path)) {

        return response()->file($path, array('Content-Type' =>'image/jpeg'));

    }

    abort(404);

}]);

and from blade im getting the images like this.

<img src="/images/1234.jpg" />

AND ITS F**ING WORKING GOOOOOD

Thank you for the support

2 likes

Please or to participate in this conversation.