Laravel Storage symlink

不打扰是莪最后的温柔 提交于 2019-12-10 14:22:19

问题


I'm trying to access files that are stored in storage/app/.../.../file.png.

I have created a symlink, linking my storage folder to public/storage.

When I try to access the appropriate file, my server throws a 404, saying file not found. Clearly I'm not accessing it the right way but I dont know what to change.

<img src="{{asset('storage/app/puppy/18/ax2Fk08nyWrV6TwTOnsXNCkNGuIdFebB7TTfPYGb.png')}}" alt="">


回答1:


when you create symlink in laravel then it create symlink of storage/app/public folder to public/storage folder. That means if you want to access any files publicly then place all your files inside storage/app/public folder and access it like this

<img src="{{asset('storage/puppy/18/test.png')}}" alt="">

Here it means the file test.png should be physically at storage/app/public/puppy/18 folder.

Execute php artisan storage:link for creating symlink in laravel

Hope it clear you




回答2:


Try this one.

<img src="{{asset('puppy/18/ax2Fk08nyWrV6TwTOnsXNCkNGuIdFebB7TTfPYGb.png')}}" alt="">


来源:https://stackoverflow.com/questions/51676037/laravel-storage-symlink

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!