H
H
HaiZenBerGG2021-08-30 19:16:30
Laravel
HaiZenBerGG, 2021-08-30 19:16:30

Public access to a file?

Hello everyone , the
problem is the following: I save avatars in storage / app / user_files
when I insert a link to an image into the template, only the one who loaded it sees
in config / filesystems.php there is a line

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

also ran
php artisan storage:link
what's wrong ? Why can't other people see Ava?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Verkan, 2021-10-30
@Verkan

The bottom line is that the user has access only to the public folder.
If these files can watch everything, store them in public or make a system link to them (That's what you want to do) if not, then behind the public folder. In this case, issue the file not through the server, but by yourself, through php. (Make a Controller that will give the given file and check if the user can see them).
Laravel makes a link to your folder in the public folder, so the user can open them.
Check the Url address and if the link to the file in the public folder is correct
617d22273cb47571408257.png
https://laravel.com/docs/8.x/filesystem#the-public-disk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question