Skip to content

Commit

Permalink
Attempt to fix corrupted file download
Browse files Browse the repository at this point in the history
  • Loading branch information
dvlpp committed Nov 20, 2018
1 parent 4df5d0d commit 3475f54
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Dvlpp/Sharp/Http/UploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function upload(Request $request)

/**
* @param $fileShortPath
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
* @return Response
* @throws FileNotFoundException
*/
public function download($fileShortPath)
{
Expand All @@ -44,10 +45,14 @@ public function download($fileShortPath)
$path = config("sharp.upload_storage_base_path") . "/" . $path;
}

return (new Response(
Storage::disk($disk)->get($path), 200
))->header('Content-Type', Storage::disk($disk)->mimeType($path))
->header("Content-Disposition", "attachment");
$response = new Response(Storage::disk($disk)->get($path), 200, [
"Content-Type" => Storage::disk($disk)->mimeType($path),
"Content-Disposition" => "attachment"
]);

ob_end_clean();

return $response;
}

private function uploadFile(Request $request)
Expand Down

0 comments on commit 3475f54

Please sign in to comment.