From 1f8b26a971aba707752effa94de92c588abb4ac6 Mon Sep 17 00:00:00 2001 From: A511701 Date: Wed, 1 Feb 2017 17:36:01 +0100 Subject: [PATCH] correction du download de gros fichiers --- application/controllers/PieceJointeController.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/application/controllers/PieceJointeController.php b/application/controllers/PieceJointeController.php index 7d4d82e8..ed1f3e7f 100755 --- a/application/controllers/PieceJointeController.php +++ b/application/controllers/PieceJointeController.php @@ -91,23 +91,20 @@ public function getAction() $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - if (!is_readable($filepath)) { + if (!is_readable($filepath)) { throw new Zend_Controller_Action_Exception('Cannot read file '.$filepath, 404); } - + + ob_get_clean(); + header("Pragma: public"); header("Expires: -1"); header("Cache-Control: public, must-revalidate, post-check=0, pre-check=0"); header('Content-Disposition: attachment; filename="'.$filename.'"'); header("Content-Type: application/octet-stream"); - $handle = fopen($filepath, "r"); - if ($handle) { - while (($buffer = fgets($handle, 4096)) !== false) { - echo $buffer; - } - fclose($handle); - } + readfile($filepath); + exit(); }