floreap's avatar

How to access in browser a storage file?

File is stored inside app/storage/app/uploads/ with the name song.mp3. I tried in URL different approaches but no success: http://localhost:8000/storage/uploads/song.mp3 doesn't work.

filesystems.php

    'links' => [
        public_path('storage') => storage_path('app/public'),
    ],
0 likes
6 replies
Snapey's avatar

If you want to access externally, you must place your files on app/public

1 like
floreap's avatar

@Snapey I was following Google advice.

When using the local driver, all files that should be publicly accessible should be placed in the storage/app/public directory. Furthermore, you should create a symbolic link at public/storage which points to the storage/app/public directory.
Snapey's avatar

@floreap thats what I said

You were storing in storage/app/uploads when it should be storage/app/public

2 likes
rodrigo.pedra's avatar

As you have this:

    'links' => [
        public_path('storage') => storage_path('app/public'),
    ],

Move your file to

app/storage/app/public/uploads/song.mp3
1 like
rodrigo.pedra's avatar
Level 56

And don't forget to run:

php artisan storage:link --force

To rebuild the symlink

1 like

Please or to participate in this conversation.