我正在尝试使用此功能下载文件,但无法正常工作,我没有收到任何错误。
public function downloadSingleFile($id )
{
$file = Upload::find($id);
$pathToFile = public_path() . '/uploads/' . $file->file_name;
return response()->download($pathToFile, $file->file_name);
}
Route::get('dashboard/download_file/{id}', 'DashboardController@downloadFile');