I cannot download my file from the local storage using php (laravel version 5.3). i've done all the research and follow everything still download won't work. no errors but no download happens.
Route::post('api/downloadfile', function($file_name = 'ExportFile.xlsx')
{
// file exist on this file path ..\storage\exports\ExportFile.xlsx
$path = storage_path().'/'.'exports'.'/'.$file_name;
if (file_exists($path)) {
ob_end_clean();
ob_start();
return Response::download($path);
}
});
and i also even tried my return as and still didn't work:
return response()->download($file);
here is my Response Header:
Accept-Ranges:none
Cache-Control:public
Connection:close
Content-Disposition:attachment; filename="ExportFile.xlsx"
Content-Length:12328
Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Date:Mon, 26 Feb 2018 07:53:32 GMT
ETag:"da39a3ee5e6b4b0d3255bfef95601890afd80709"
Host:localhost:8000
and i even modified the headers.