From ecebf3a8627f527cbd184b7907dd91f65764617b Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 2 Dec 2008 22:03:22 +0100 Subject: Make content-disposition configurable in mime.conf FS#1541 With this patch it is possible to define if a file should be served as download or be displayed inside the browser (if supported) by configuring it in conf/mime.conf Mimetypes that should be served with a "Content-Disposition: attachment" header need to be prefixed with a exclamation mark. All others will be served inline. This will also fix a Problem with Flash 10. darcs-hash:20081202210322-7ad00-6e7ef30aff9322cd135311be77809187da121f3b.gz --- inc/confutils.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'inc/confutils.php') diff --git a/inc/confutils.php b/inc/confutils.php index a7799b9d4..1ef0942f8 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -14,7 +14,7 @@ * @author Andreas Gohr */ function mimetype($file){ - $ret = array(false,false); // return array + $ret = array(false,false,false); // return array $mtypes = getMimeTypes(); // known mimetypes $exts = join('|',array_keys($mtypes)); // known extensions (regexp) if(preg_match('#\.('.$exts.')$#i',$file,$matches)){ @@ -22,7 +22,11 @@ function mimetype($file){ } if($ext && $mtypes[$ext]){ - $ret = array($ext, $mtypes[$ext]); + if($mtypes[$ext][0] == '!'){ + $ret = array($ext, substr($mtypes[$ext],1), true); + }else{ + $ret = array($ext, $mtypes[$ext], false); + } } return $ret; -- cgit v1.2.3