Laravel - link to a file saved in storage folder

后端 未结 3 838
日久生厌
日久生厌 2020-12-17 02:45

When we do something like this:

Storage::disk(\'local\')->put(\'file.txt\', \'Contents\');

How do you make a link to that file in a view

3条回答
  •  醉酒成梦
    2020-12-17 03:17

    UPDATE:

    According to laravel docs, You can get the URL to the file like this:

    use Illuminate\Support\Facades\Storage;
    
    $url = Storage::url('file1.jpg');
    

    Remember, if you are using the local driver, all files that should be publicly accessible should be placed in the storage/app/public directory. Furthermore, you should create a symbolic link at public/storage which points to the storage/app/public directory.

    Hope this helps!

提交回复
热议问题