https://laravel.com/docs/8.x/filesystem#the-public-disk
php artisan storage:link
ok so now I have deloyed, I upload an image via NOVA and when I view it, I can see it goes into:
/public/storage/X7k7f1fNTpTVMwlfMJMX0tQaSQJEdSdHNp5Ujvrt.jpg
but it's not showing in my application or in Nova?!
https://laravel.com/docs/8.x/filesystem#the-public-disk
php artisan storage:link
yep, done that
The [/var/www/vhosts/mywebsite.com/httpdocs/moapi/public/storage] link already exists.
look in your browser network tools
what url is it trying to load the image from?
inspect the url of the image and open it in new tab... double check any mistake of the path or https/http issue....
so at:
https://www.jbiddulph.com/storage/EtA7Eztl38fdH9UTQGh0ieEKx7DSbYxn5LCxKRZL.jpg
I get 403
my server path is: /htdocs/moapi/public/storage/(images) Please help
hosting is pointing to: /htdocs/moapi/public/
@boyjarv check your public directory for the folder/file list public/storage/folder_list ....if not then delete storage folder from public directory and re link the storage folder
and in your .env file make some changes FILESYSTEM_DRIVER=public
your images are inside the directory/folder or in the direct directory ? ...
theres this: Home directory > httpdocs > moapi > public > storage
and there is this: Home directory > httpdocs > moapi > storage > app > public
I'm so confused
can anyone help me here please?
If you have run php artisan storage:link then storage/app/public and public/storage are one and the same (actually public/storage points to the storage folder)
If your browser cannot load an image then you need to look in the browser network tools and see what URI it is trying to load. Then compare that with where you think the file is.
Remember you can just enter the image URL directly in your browser to confirm
when I go there directly, it gives me a 403
You left out a vital piece of information:
Forbidden You do not have permission to access this document.
You need to check the ownership of the files and make sure your webserver has permission
You have other permission problems not just images. EG if I try to access an invalid route:
The stream or file "/var/www/vhosts/jbiddulph.com/httpdocs/moapi/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied
So you cannot write to log files either
and I've broken something by trying to fix it:
here's my other probably related post https://laracasts.com/discuss/channels/laravel/permission-error-on-laravellog-file
I'm back to this now:
Server Error 403 Forbidden You do not have permission to access this document.
https://www.mywebsite.com/storage/app/public/RZOB0PgcmeQGT1CvgGCwyahC6TASmIdGAK9D3p4V.jpg
the image URL should not contain 'app/public'
https://www.mywebsite.com/storage/app/public/RZOB0PgcmeQGT1CvgGCwyahC6TASmIdGAK9D3p4V.jpg
should be
https://www.mywebsite.com/storage/RZOB0PgcmeQGT1CvgGCwyahC6TASmIdGAK9D3p4V.jpg
Thank you, that is also displaying:
Server Error 403 Forbidden
because you have done nothing to investigate the permissions error
I just deleted the storage folder and ran:
php artisan storage:link --relative
still the same:
403
What user are you logged in as when you create these files and folders?
What user account is the web server using?
Are your account and the webserver part of the same group?
You can answer these questions by listing the files and checking ownership
me:
/var/www/vhosts/mywebsite.com/httpdocs/moapi/public/storage
ls -l
-rw-r--r-- 1 jarv psacln 440963 Aug 5 19:48 RZOB0PgcmeQGT1CvgGCwyahC6TASmIdGAK9D3p4V.jpg -rw-r--r-- 1 jarv psacln 180990 Aug 5 19:46 x1VJSh4GNC2YvtME9LvawVMZGUdi8HlyuqGdOs10.jpg
so the files are owned by jarv and the webserver (application) and cannot access them
ok..... so I did have a look at jarvs permissions but how can change the ownership to the webserver?
You have to complete the steps I gave earlier. Then you can use chown to change ownership once you have uploaded the files.
so I just ran:
chown -R jarv:psacln storage
and now I get:
-rwxrwxr-x 1 jarv psacln 1794444 Aug 5 20:22 beqM06dNuPaiP73ymYuLskyPIRw5kfTzUuVrwp6N.jpg
-rwxrwxr-x 1 jarv psacln 440963 Aug 5 20:21 dlKew5f5ErVzwHdgoPrzdbG2khcsoTopdnlMXekH.jpg
-rwxrwxr-x 1 jarv psacln 440963 Aug 5 19:48 RZOB0PgcmeQGT1CvgGCwyahC6TASmIdGAK9D3p4V.jpg
-rwxrwxr-x 1 jarv psacln 180990 Aug 5 19:46 x1VJSh4GNC2YvtME9LvawVMZGUdi8HlyuqGdOs10.jpg
Thank you so much SNAPEY for all your help!
Please or to participate in this conversation.