When using Response::download
to download files, I noticed that images and other binary files were being transferred incorrectly.
Changing the Content-Type
header didn't change anything, nor did explicitly disallowing cache or forcing the content's length.
What may be the cause of this problem?
The solution to this problem can be found here:
http://simpledeveloper.com/how-to-fix-laravel-response-image-download-in-laravel/
The cause of the issue was due to Laravel/Symfony not properly cleaning the output buffer for some reason, so the solution is this:
$response = Response::download($path, ...);
ob_end_clean();
return $response;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With