Hi I'm trying to fix a Laravel download bug I am dealing with. I have the correct route setup, and correct function in the controller. I also am able to confirm that I have access to the file because I created a file using the exact same route and returned it. By doing this I was able to successfully return the contents of the file. However when I try and use a button from the view and call the controller function I get this error:
FileNotFoundException in File.php line 37:
The file "The file "2016-04-04_07-21-50 - Pinging host: 192.168.2.1
2016-04-04_07-21-50 - Host 192.168.2.1 is up!
2016-04-04_07-21-50 - Pinging host: 192.168.2.2
2016-04-04_07-21-53 - Pinging host: 192.168.2.3 ...
Now here is the code that resulted in this error:
show.blade.php
<a class="btn btn-default col-md-12" href="/getDownload/{{ $now }}" role="button">Download Today's Log</a>
HonoursController.php
public function getDownload($id)
{
$file = File::get("../resources/logs/$id");
$headers = array(
'Content-Type: application/octet-stream',
);
#return Response::download($file, $id. '.' .$type, $headers);
return response()->download($file, $id.'txt', $headers);
}
What I have been able to surmise is that I am getting a 500 HTTP error. My inspection does not provide me with any other information however. Any idea what is going on?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire