diff options
author | ytetsuro <phper.0o0@gmail.com> | 2018-02-05 16:01:45 +0100 |
---|---|---|
committer | ytetsuro <phper.0o0@gmail.com> | 2018-02-05 16:12:28 +0100 |
commit | 8f04f20b0f63ace705e4371a24d0ddf139655dba (patch) | |
tree | 1cdb94630f337c13d8ebfc6e0017270261d794ad /system/helpers | |
parent | 4dc34279cdc19b7a1df3385b1f679aeac6767c89 (diff) |
Changed to include Content-Disposition parameters in variables
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/download_helper.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index afdb77956..43e12cf9e 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -147,21 +147,21 @@ if ( ! function_exists('force_download')) @ob_clean(); } - $utf8_filename = $filename; + $disposition = 'attachment; filename="'.$filename.'";'; $charset = config_item('charset'); if (strtoupper($charset) !== 'UTF-8') { - $converted_filename = get_instance()->utf8->convert_to_utf8($utf8_filename, $charset); - if ($converted_filename !== FALSE) + // charset attribute (RFC 6266 only allows UTF-8) + $utf8_filename = get_instance()->utf8->convert_to_utf8($filename, $charset); + if ($utf8_filename !== FALSE) { - $utf8_filename = $converted_filename; + $disposition .= ' filename*=UTF-8\'\''.rawurlencode($utf8_filename); } } // Generate the server headers header('Content-Type: '.$mime); - // charset attribute (RFC 6266 only allows UTF-8) - header('Content-Disposition: attachment; filename="'.$filename.'"; filename*=UTF-8\'\''.rawurlencode($utf8_filename)); + header('Content-Disposition: '.$disposition); header('Expires: 0'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.$filesize); |