note 21836 added to function.header

From: Date: Tue, 28 May 2002 20:50:06 +0000
Subject: note 21836 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-31127@lists.php.net to get a copy of this message
Additional notes to my workaround on Q266305: I have tested my findings with PDF, XLS, DOC and ZIP. However JPG and GIF didn't make IE pop up the download box. By changing content type from "octet-stream" to "force-download" (or some undefined type), it will work. Of course, we need to take care of other browsers too. Here is the improved code, hope it helps: header("Content-type: application/force-download"); if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) header("Content-Disposition: filename=$myfile" . "%20"); // For IE else header("Content-Disposition: attachment; filename=$myfile"); // For Other browsers Note: If you are using session together with this download, you will need to add the following line BEFORE the code above to make IE work: session_cache_limiter(""); -- http://www.php.net/manual/en/function.header.php http://master.php.net/manage/user-notes.php?action=edit+21836 http://master.php.net/manage/user-notes.php?action=delete+21836 http://master.php.net/manage/user-notes.php?action=reject+21836

« previous php.notes (#31127) next »