diff options
author | Gerry Weißbach <gerry.w@gammaproduction.de> | 2014-01-27 10:07:59 +0100 |
---|---|---|
committer | Gerry Weißbach <gerry.w@gammaproduction.de> | 2014-01-27 10:07:59 +0100 |
commit | 32c584aadfbf4d297dbea400e69a0255614ff542 (patch) | |
tree | aa52947657f7ed021bc5bcc159e96870d8f6f1b9 /inc/fetch.functions.php | |
parent | ed977ec442291eeffb1c5b246dc20b59a4a09b0b (diff) | |
download | rpg-32c584aadfbf4d297dbea400e69a0255614ff542.tar.gz rpg-32c584aadfbf4d297dbea400e69a0255614ff542.tar.bz2 |
Use original filename for Content-Disposition
In most cases this change will have no effect, but noes the response will use the filename that was originally requested. The downloaded filename can be modified to something different as well. E.g. the siteexport plugin will make use of it.
Diffstat (limited to 'inc/fetch.functions.php')
-rw-r--r-- | inc/fetch.functions.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php index 207ad9e5f..3e563b324 100644 --- a/inc/fetch.functions.php +++ b/inc/fetch.functions.php @@ -16,12 +16,13 @@ * @author Andreas Gohr <andi@splitbrain.org> * @author Ben Coburn <btcoburn@silicodon.net> * @param string $file local file to send + * @param string $orig original file to send - the file name will be used for the Content-Disposition * @param string $mime mime type of the file * @param bool $dl set to true to force a browser download * @param int $cache remaining cache time in seconds (-1 for $conf['cache'], 0 for no-cache) * @param bool $public is this a public ressource or a private one? */ -function sendFile($file, $mime, $dl, $cache, $public = false) { +function sendFile($file, $orig, $mime, $dl, $cache, $public = false) { global $conf; // send mime headers header("Content-Type: $mime"); @@ -64,9 +65,9 @@ function sendFile($file, $mime, $dl, $cache, $public = false) { //download or display? if($dl) { - header('Content-Disposition: attachment; filename="'.utf8_basename($file).'";'); + header('Content-Disposition: attachment; filename="'.utf8_basename($orig).'";'); } else { - header('Content-Disposition: inline; filename="'.utf8_basename($file).'";'); + header('Content-Disposition: inline; filename="'.utf8_basename($orig).'";'); } //use x-sendfile header to pass the delivery to compatible webservers |