From 3037e5c3acf6da2b7e4c7f70ad63035db4e5f8ea Mon Sep 17 00:00:00 2001 From: Antoine de Roquemaurel Date: Tue, 18 Apr 2017 22:49:19 +0200 Subject: [PATCH] Downloading album : clean and flush before send zip file to avoid 500 error. --- php/Modules/Album.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/php/Modules/Album.php b/php/Modules/Album.php index 1754cb0..fef65cf 100644 --- a/php/Modules/Album.php +++ b/php/Modules/Album.php @@ -306,9 +306,14 @@ final class Album { $zip->close(); // Send zip - header("Content-Type: application/zip"); - header("Content-Disposition: attachment; filename=\"$zipTitle.zip\""); - header("Content-Length: " . filesize($filename)); + header("Content-type: application/zip"); + header("Content-disposition: attachment; filename=\"$zipTitle.zip\""); + header("Content-length: " . filesize($filename)); + + // Clean before, in order to avoid 500 error + ob_end_clean(); + flush(); + readfile($filename); // Delete zip @@ -642,4 +647,4 @@ final class Album { } -?> \ No newline at end of file +?>