From 65c069013c37e0a17834af761e57bb0cce936b92 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 4 Feb 2014 18:01:44 -0600 Subject: [PATCH] oops: Fix missing filename in HTTP download --- include/class.http.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/class.http.php b/include/class.http.php index a96ab84ab..3baea958a 100644 --- a/include/class.http.php +++ b/include/class.http.php @@ -95,14 +95,15 @@ class Http { return "filename*=UTF-8''".rawurlencode($filename); } - function download($filename, $type, $data=null) { + function download($filename, $type, $data=null, $disposition='attachment') { header('Pragma: private'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private'); header('Content-Type: '.$type); - header('Content-Disposition: attachment; %s;', - self::getDispositionFilename(basename($filename))); + header(sprintf('Content-Disposition: %s; %s', + $disposition, + self::getDispositionFilename(basename($filename)))); header('Content-Transfer-Encoding: binary'); if ($data !== null) { header('Content-Length: '.strlen($data)); -- GitLab