From 57cbbdab56c6598a1e813ea68f4ad314dc06b764 Mon Sep 17 00:00:00 2001 From: jekkos-t520 Date: Wed, 11 Feb 2015 14:00:27 +0100 Subject: [PATCH] Remove content-length header for download Clean headers (if already output) before force_download --- application/controllers/config.php | 7 ++++--- system/helpers/download_helper.php | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/application/controllers/config.php b/application/controllers/config.php index a75dee706..1b83cb66e 100644 --- a/application/controllers/config.php +++ b/application/controllers/config.php @@ -133,13 +133,14 @@ class Config extends Secure_area { $this->load->dbutil(); $prefs = array( - 'format' => 'txt', + 'format' => 'zip', 'filename' => 'ospos.sql' ); - $backup = $this->dbutil->backup($prefs); + $backup =& $this->dbutil->backup($prefs); - $file_name = 'ospos-' . date("Y-m-d-H-i-s") .'.sql'; + $file_name = 'ospos-' . date("Y-m-d-H-i-s") .'.zip'; + $save = 'uploads/'.$file_name; $this->load->helper('download'); while (ob_get_level()) { ob_end_clean(); diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 16ee4e9cd..23ddb87fc 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -86,7 +86,6 @@ if ( ! function_exists('force_download')) header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header("Content-Transfer-Encoding: binary"); header('Pragma: public'); - header("Content-Length: ".strlen($data)); } else { @@ -95,7 +94,6 @@ if ( ! function_exists('force_download')) header("Content-Transfer-Encoding: binary"); header('Expires: 0'); header('Pragma: no-cache'); - header("Content-Length: ".strlen($data)); } exit($data); }