My code is not working to download the file. Im using laravel and the error is Array to string conversion
if($request->ajax()){
$fileexists = Storage::disk('batchlog')->exists($request->filename);
if($fileexists){
return response()->download(storage_path("app/batchlog/{$request->filename}"));
}else{
return response()->json(__('approvals.batch-file-not-available'));
}
}else{
return redirect()->route('login')->with('servicemessage', __('errors.request-not-allowed'));
}
if($request->ajax()){
$fileexists = Storage::disk('batchlog')->exists($request->filename);
if($fileexists){
return response()->download(storage_path("app/batchlog/{$request->filename}"));
}else{
return response()->json(__('approvals.batch-file-not-available'));
}
}else{
return redirect()->route('login')->with('servicemessage', __('errors.request-not-allowed'));
}