I have a small problem with the name of the files when they are downloaded. So I release them
public function expensesAndTravel(){
$file = storage_path() . '\app\excel\REPORTE DE GASTOS Y VIATICOS.xlsx';
$headers = ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
return response()->file($file, $headers);
}
The file is downloaded without problem, but the name of the file takes it from how it declares my route, in this case
Route::get('files/expenses-travel', array(
'as' => 'files.expenses.travel',
'uses' => 'FilesController@expensesAndTravel'
));
It is downloaded with the names of expenses-travel
, in the documentation of laravel
I find nothing with respect to maintaining the name, however if you can with the method response->donwload()
, but with the file()
that is the one I need I can not, the only alternative I found is to put the full name of the file as the name of my route. Is there any way to keep the name from my controller and not take the name of the route?