From: Stéphane Jacob Date: Mon, 3 Oct 2011 20:01:17 +0000 (+0200) Subject: Allows to set file name in headers. X-Git-Tag: core/1.1.6~3 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=bdcf4c153ff7bc5fc18dd828bc3d12519b7c719c;p=platal.git Allows to set file name in headers. Signed-off-by: Stéphane Jacob --- diff --git a/include/platal.inc.php b/include/platal.inc.php index f9bf127..6b28abb 100644 --- a/include/platal.inc.php +++ b/include/platal.inc.php @@ -261,7 +261,7 @@ function pl_content_headers($content_type, $encoding = 'utf-8') * cache duration defaults to the global static_cache_duration. No encoding is * applied by default. */ -function pl_cached_content_headers($content_type, $encoding = null, $cache_duration = -1) +function pl_cached_content_headers($content_type, $encoding = null, $cache_duration = -1, $filename = null) { global $globals; $cache_duration = ($cache_duration < 0 ? $globals->static_cache_duration : $cache_duration); @@ -270,6 +270,9 @@ function pl_cached_content_headers($content_type, $encoding = null, $cache_durat header("Expires: " . gmdate('D, d M Y H:i:s', time() + $cache_duration) . " GMT"); header("Pragma: "); pl_content_headers($content_type, $encoding); + if (!is_null($filename)) { + header('Content-Disposition: attachment; filename=' . $filename); + } } /**