]> git.mjollnir.org Git - moodle.git/commitdiff
making multibyte filename appear correctly under IE download
authortoyomoyo <toyomoyo>
Tue, 30 Oct 2007 00:35:18 +0000 (00:35 +0000)
committertoyomoyo <toyomoyo>
Tue, 30 Oct 2007 00:35:18 +0000 (00:35 +0000)
lib/filelib.php

index 36145b8ecfed80664fb61745d6b647ed4f5f1cb1..7a4f0ac3007934dde598fc76a487adfccb49a1a5 100644 (file)
@@ -345,6 +345,11 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring=
     //TODO: should we remove all those @ before the header()? Are all of the values supported on all servers?
     header('Last-Modified: '. gmdate('D, d M Y H:i:s', $lastmodified) .' GMT');
 
+    // if user is using IE, urlencode the filename so that multibyte file name will show up correctly on popup
+    if (check_browser_version('MSIE')) {
+        $filename = urlencode($filename); 
+    }
+
     if ($forcedownload) {
         @header('Content-Disposition: attachment; filename='.$filename);
     } else {