You probably should not have linked another folder. Did you check if visibility is public for the file? Did you check the url? There are helper commands for all of that.Also, remember to try a slash in front of paths. Depending on config, you may need it.
Storage::url('file1.jpg');
Storage::getVisibility('file.jpg');
Nov 30, 2016
13
Level 1
Access file in symbolic link folder public/storage
Hi everyone. I have problem with "php artisan storage:link". I use homestead and vagrant on window 7 Ultimate. I have 2 cases:
- 1/ I used command "php artisan storage:link"
- RESULT:
- command is successful
- a new folder called storage is created in public WITH icon shortcut. See screenshot http://prntscr.com/ddqhpb
- when upload 1 image with my own controller, the image will store in storage/app/public/avatars/file1.jpg, at the same time the image will be stored in root/public/storage/avatars/file1.jpg => that works great.
- PROBLEM:
- I can not access to file1.jpg in root/public/avatars/file1.jpg. I try by access on browser domain/storage/avatars/file1.jpg or call in code asset('storage/file1.jpg'). But them return 404 page.
- 2/ I used "ln -sr storage/app/public public/storage" https://laracasts.com/discuss/channels/servers/creating-symbolic-link-on-homestead
- RESULT:
- a new folder called storage is created in public WITHOUT icon shortcut.
- I temporary put 1 image with name file2.jpg into root/public/storage. Then access on browser domain/storage/avatars/file2.jpg => It woks normally.
- PROBLEM:
- When upload a image with my own controller (same case 1), there is just 1 image show in root/storage/app/public/avatars/file3.jpg , in symbolic link public/storage/avatars, the image file3.jpg do not exist Do Anyone else have same problem with me ?
Level 1
Hi @WebKenth and @ejdelmonico my endless efforts finally have perfect result. My problem is i use window 7 and i use vagrant and virtualbox on it. Since Windows doesn't have native support for Linux-style symlinks, this would fail and break provisioning.. My steps for fixing it.
- Add permission to create symbolic link http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7
- I user Git bash for my command line. And i need Run As Administrator. I access
- vagrant ssh
- cd "path_root_my_project"
- php artisan storage:link
- Check folder public, i saw a unknown file call storage, not directory http://prntscr.com/dexd43 . But it works now.
Please or to participate in this conversation.