|
|
|
@ -94,7 +94,12 @@ class ProjectDokumenController extends Controller
|
|
|
|
|
if(!file_exists($this->pathDocument.$document->file)) |
|
|
|
|
return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404); |
|
|
|
|
|
|
|
|
|
$pathToFile = $this->pathDocument.$document->file; |
|
|
|
|
return response()->download($pathToFile); |
|
|
|
|
$pathToFile = $this->pathDocument.$document->file; |
|
|
|
|
$name = pathinfo($pathToFile, PATHINFO_FILENAME) . "." . pathinfo($pathToFile, PATHINFO_EXTENSION); |
|
|
|
|
$headers = [ |
|
|
|
|
'Content-Disposition' => 'attachment; filename="'.$name.'"' |
|
|
|
|
]; |
|
|
|
|
// dd($name, $headers); |
|
|
|
|
return response()->download($pathToFile, $name, $headers); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|