Browse Source

Merge pull request 'fix upload dokumen' (#41) from dev-wahyu into staging

Reviewed-on: ordo/adw-backend#41
Reviewed-by: ibnu <ibnu@mail.com>
pull/3/head
ibnu 2 years ago
parent
commit
3be5b429a9
  1. 7
      app/Http/Controllers/ProjectDokumenController.php

7
app/Http/Controllers/ProjectDokumenController.php

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

Loading…
Cancel
Save