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.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zQFGYi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire