Hello i have some problem with doing a force download. Here is my code :
public function download(Request $request, $id) {
$document = Document::find($id);
$s3 = Storage::disk('s3');
$name = substr($document->link, strrpos($document->link, '/') + 1);
$file = $s3->get($name);
$headers = [
'Content-Type' => 'application/pdf',
'Content-Description' => 'File Transfer',
'Content-Disposition' => "attachment; filename={$name}",
'filename'=> $name
];
return response()->download($file);
}
i don't get it how to access the good file
response :
is_file() expects parameter 1 to be a valid path, string given
Any ideas ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire