If storage/public
refers to something like /home/user/projeto-em-laravel/public/storage/public
I think it would be interesting to change your strategy, the folder storage
should not be directly accessed and will not be able to, unless you have done something very wrong, the correct is to use the function asset
, thus:
echo asset('storage/file.txt');
According to the documentation https://laravel.com/docs/5.3/filesystem#the-public-disk
The public disk is intended for files that will be publicly accessible. By default, the public disk uses the local disk and stores those files on storage/app/public
.
To make them accessible from the web, you can create a symbolic link from public/storage
for storage/app/public
.
To create the symbiotic link you must execute the command:
php artisan storage:link
Once created, you can create a url and use the "helper" function called asset
within a route:
echo asset('storage/file.txt');
You can access it like this (I’m not sure if you have to enter the prefix public/
):
<img src="storage/3.jpg">
It is not correct to do this, the public should actually represent the root
of an HTTP page, for example in Apache:
DocumentRoot "/home/user/projeto-em-laravel/public"
<Directory "/home/user/projeto-em-laravel/public">
AllowOverride all
</Directory>
Then the images would be accessible like this:
<img src="3.jpg">
If it’s in the folder /home/user/projeto-em-laravel/public/images/3.jpg
, would look like this:
<img src="images/3.jpg">
If you are images/3.jpg
background use in a CSS like this /home/user/projeto-em-laravel/public/css/meucss.css
then you should use the ../
, thus:
seletor {
background: url(../images/3.jpg);
}
Read more on: /a/91799/3635
try direct 3.jpg, the public is the root of the project
– Douglas Carvalho
@Douglascarvalho is actually a briefcase with a public name inside
Storage/app
– Felipe Paetzold