diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-01-25 09:59:01 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-01-25 09:59:01 +0100 |
commit | d5e07b072cf05a24ad24e0b5d4b55eaa50d1c655 (patch) | |
tree | c70fbf11e9add3bf4b6ff211cd53b18ae903e67f /system/helpers/download_helper.php | |
parent | 96db8f91c34c18119548cacc4692362f51e70407 (diff) | |
parent | 0e4d2b652ec4b0027b188a7aa84a9862b968f780 (diff) |
Merge pull request #957 from cryode/bug/force_download
Fix bug #195
Diffstat (limited to 'system/helpers/download_helper.php')
-rw-r--r-- | system/helpers/download_helper.php | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 4a1a79cc3..aea948d81 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -88,26 +88,20 @@ if ( ! function_exists('force_download')) { $mime = (is_array($mimes[$extension])) ? $mimes[$extension][0] : $mimes[$extension]; } - + // Generate the server headers - if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== FALSE) + header('Content-Type: "'.$mime.'"'); + header('Content-Disposition: attachment; filename="'.$filename.'"'); + header('Expires: 0'); + header("Content-Transfer-Encoding: binary"); + header("Content-Length: ".strlen($data)); + header('Pragma: no-cache'); + + // Internet Explorer-specific headers. + if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== FALSE) { - header('Content-Type: "'.$mime.'"'); - header('Content-Disposition: attachment; filename="'.$filename.'"'); - header('Expires: 0'); 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 - { - header('Content-Type: "'.$mime.'"'); - header('Content-Disposition: attachment; filename="'.$filename.'"'); - header("Content-Transfer-Encoding: binary"); - header('Expires: 0'); - header('Pragma: no-cache'); - header("Content-Length: ".strlen($data)); } exit($data); |