diff options
Diffstat (limited to 'core/ProxyHttp.php')
-rw-r--r-- | core/ProxyHttp.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/ProxyHttp.php b/core/ProxyHttp.php index 790d62229d..bf3bbf43e3 100644 --- a/core/ProxyHttp.php +++ b/core/ProxyHttp.php @@ -60,9 +60,12 @@ class ProxyHttp * of the file will be served. * @param int|false $byteEnd The ending byte in the file to serve. If false, the data from $byteStart to the * end of the file will be served. + * @param string|false $filename By default the filename of $file is reused as Content-Disposition. If the + * file should be sent as a different filename to the client you can specify + * a custom filename here. */ public static function serverStaticFile($file, $contentType, $expireFarFutureDays = 100, $byteStart = false, - $byteEnd = false) + $byteEnd = false, $filename = false) { // if the file cannot be found return HTTP status code '404' if (!file_exists($file)) { @@ -78,7 +81,12 @@ class ProxyHttp // set some HTTP response headers self::overrideCacheControlHeaders('public'); Common::sendHeader('Vary: Accept-Encoding'); - Common::sendHeader('Content-Disposition: inline; filename=' . basename($file)); + + if (false === $filename) { + $filename = basename($file); + } + + Common::sendHeader('Content-Disposition: inline; filename=' . $filename); if ($expireFarFutureDays) { // Required by proxy caches potentially in between the browser and server to cache the request indeed |