[-] FO: Fix #PSCFV-9057 close output buffer before sending attachment and virtualproducts

This commit is contained in:
Rémi Gaillard
2013-05-14 18:13:07 +02:00
parent 2bcd5bd0c2
commit f33e8d8b4a
2 changed files with 6 additions and 1 deletions
@@ -32,6 +32,9 @@ class AttachmentControllerCore extends FrontController
if (!$a->id)
Tools::redirect('index.php');
if (ob_get_level())
ob_end_clean();
header('Content-Transfer-Encoding: binary');
header('Content-Type: '.$a->mime);
header('Content-Length: '.filesize(_PS_DOWNLOAD_DIR_.$a->file));
+3 -1
View File
@@ -270,12 +270,14 @@ class GetFileControllerCore extends FrontController
$mimeType = 'application/octet-stream';
}
if (ob_get_level())
ob_end_clean();
/* Set headers for download */
header('Content-Transfer-Encoding: binary');
header('Content-Type: '.$mimeType);
header('Content-Length: '.filesize($file));
header('Content-Disposition: attachment; filename="'.$filename.'"');
ob_end_flush();
$fp = fopen($file, 'rb');
while (!feof($fp))
echo fgets($fp, 16384);