lundi 30 octobre 2017

Force download of PDF in Laravel 5.5

On a page I have a link:

<a href="" target="_blank" title="download PDF">@fa('download')</a>&nbsp;&nbsp;

and in the web.php I have:

Route::get('downloadWirebird/{id}','FrontController@downloadWirebird')->name('downloadWirebird');

In FrontController I have:

public function downloadWirebird($id)
                {
                  $wbd = Wirebird::find($id);
                  $fileName = asset('Wirebird')."/".$wbd->PDF;
                  $headers = ['Content-Type: application/pdf'];
                  return response()->download($fileName, $headers);
                }

All the paths are correct but when I click on the link absolutely nothing happens.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire