diff options
author | David M <davidmj@users.sourceforge.net> | 2006-10-23 21:07:45 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2006-10-23 21:07:45 +0000 |
commit | a0201b4958b6e29134e72fbd2052d80bb06ec299 (patch) | |
tree | 66adf42023d10c3c1965b1e564234599427d12f7 | |
parent | 74e03ddf621c794243252f04ac4e2f81003ec87b (diff) | |
download | forums-a0201b4958b6e29134e72fbd2052d80bb06ec299.tar forums-a0201b4958b6e29134e72fbd2052d80bb06ec299.tar.gz forums-a0201b4958b6e29134e72fbd2052d80bb06ec299.tar.bz2 forums-a0201b4958b6e29134e72fbd2052d80bb06ec299.tar.xz forums-a0201b4958b6e29134e72fbd2052d80bb06ec299.zip |
#4850
git-svn-id: file:///svn/phpbb/trunk@6523 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/download.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/phpBB/download.php b/phpBB/download.php index ccc23b94b8..6f4dc329f7 100644 --- a/phpBB/download.php +++ b/phpBB/download.php @@ -232,8 +232,8 @@ function send_file_to_browser($attachment, $upload_dir, $category) } // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. - header('Content-Type: ' . $attachment['mimetype'] . '; name="' . $attachment['real_filename'] . '"'); - header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; filename="' . $attachment['real_filename'] . '"'); + header('Content-Type: ' . $attachment['mimetype']); + header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename($attachment['real_filename'])); if ($size) { @@ -247,6 +247,23 @@ function send_file_to_browser($attachment, $upload_dir, $category) exit; } +/* +* Get a browser friendly UTF-8 encoded filename +*/ +function header_filename($file) +{ + // There be dragons here... + // IE follows no RFC, follow the RFC for extended filename for the rest + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) + { + return "filename=" . rawurlencode($file); + } + else + { + return "filename*=UTF-8''" . rawurlencode($file); + } +} + /** * Check if downloading item is allowed */ |