Closed jbmckee closed 7 years ago
Have you tried special response methods for file uploads?
Thanks for posting in our issue tracker. In order to properly assist you, we need additional information:
Thanks!
This is an automated comment, triggered by adding the label status:need more info
.
I originally was going to use Yii::$app->response->sendContentAsFile($zipfile, $file_name)->send(); but was under the impression that there was a bug with this method. This is why I went with the Yii::$app->response->content = $zipfile;
However, I just tried Yii::$app->response->sendContentAsFile($zipfile, $file_name)->send(); on Mac in both Chrome and Safari and by golly, it did work. So, maybe whatever bug there was has been fixed.
Thanks for your attention.
I am using the following to allow a user to download a generated zip file:
This works fine in every browser except Safari. Unfortunately, if the file name is file.zip, it downloads as file.zip.html
However, this works as expected: header('Content-Type: application/zip'); header("Content-disposition: attachment; filename={$file_name}"); echo $zipfile; exit;