mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
git-svn-id: file:///svn/phpbb/trunk@6523 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
74e03ddf62
commit
a0201b4958
1 changed files with 19 additions and 2 deletions
|
@ -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.
|
// 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-Type: ' . $attachment['mimetype']);
|
||||||
header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; filename="' . $attachment['real_filename'] . '"');
|
header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename($attachment['real_filename']));
|
||||||
|
|
||||||
if ($size)
|
if ($size)
|
||||||
{
|
{
|
||||||
|
@ -247,6 +247,23 @@ function send_file_to_browser($attachment, $upload_dir, $category)
|
||||||
exit;
|
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
|
* Check if downloading item is allowed
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue