samedi 14 avril 2018

Laravel 5.5 downloads

I have a problem with a forced download:

In my page I have a line of code:

@php
  $pg = "/downloadWirebird/".$mag->PDF;
@endphp
<a href="">@fa('download')</a>&nbsp;&nbsp

In my web.php file I have:

Route::get('/downloadWirebird/{file}','DownloadsController@downloadWirebird');

I then have the following method in my controller:

public function downloadWirebird($file)
 {
 $file_path = public_path('Wirebird/').$file;
 return response()->download($file_path);
 }

but I am getting a response

Symfony \ Component \ HttpFoundation \ File \ Exception \ FileNotFoundException The file "/home/sites/sthelena.uk.net/public_html/work/public/Wirebird" does not exist

It seems to ignore the file itself.

Any help will be gratefully appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire