I have images stored in my storage/app/images folder.
However, I cannot access or view any of these images on localhost without a 404 header.
I'm using Apache with the following htaccess to my Laravel REST API
RewriteEngine On
RewriteBase /backendLaravel/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [QSA,L]
I followed the php artisan storage:link
that Laravel Docs provide, however nothing changes.
I want to be able to access these files publicly using http. So, http://endpoint/SDUpload/hello.jpeg
How do I achieve this
storage:link
creates a symbolic link from public/storage
to storage/app/public
. Try either moving your storage/app/images
folder to storage/app/public/images
or create a symbolic link from public/storage/images
to storage/app/images
with: ln -s storage/app/images public/storage/images
.
I haven't tried this but I'm assuming it would work. In Laravel there is a public_path() helper as well as a storage_path() helper. If you are trying to display these images online in your html, you can try to use the storage helper. Each of these helpers are used to access the given directory, either storage or public.
Example:
<img src="{{ storage_path('app/images/image.jpg')">
Hope I could help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.