0

Here is the code:

<a download="MyPdf" href="{{ storage('app/public/file.pdf') }}" title="MyPdf">Download</a>

The file.pdf are in the folder storage/app/public

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
DevTeam
  • 23
  • 1
  • 4

2 Answers2

1

First you need to create a symbolic link

php artisan storage:link

That will create a symbolic link to /storage/app/public

After you need use Storage::url();

Example:

<a download="MyPdf" href="{{ Storage::url('file.pdf') }}" title="MyPdf">Download</a>

With this you will download what is in the /storage/app/public/file.pdf folder

Bulfaitelo
  • 515
  • 7
  • 18
0
  1. add url like

    Route::get('get/file', function(){
        return Storage::download('path to file');
    })
    
  2. now hit the url and you will download the file

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Ahmed Nawaz Khan
  • 1,451
  • 3
  • 20
  • 42