note 21836 deleted from function.header by sniper
| From: | sniper@php.net | Date: | Sun, 07 Sep 2003 21:28:58 +0000 |
| Subject: | note 21836 deleted from function.header by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55603@lists.php.net to get a copy of this message | ||
Note Submitter: simon.lee@terago.ca
----
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("");