How to get file URL using Storage facade in laravel 5?

前端 未结 13 643
庸人自扰
庸人自扰 2020-11-30 22:40

I\'ve been experimenting using the new Flysystem integration with Laravel 5. I am storing \'localised\' paths to the DB, and getting the Storage facade to complete the path

13条回答
  •  有刺的猬
    2020-11-30 23:32

    Take a look at this: How to use storage_path() to view an image in laravel 4 . The same applies to Laravel 5:

    Storage is for the file system, and the most part of it is not accessible to the web server. The recommended solution is to store the images somewhere in the public folder (which is the document root), in the public/screenshots/ for example. Then when you want to display them, use asset('screenshots/1.jpg').

提交回复
热议问题