RE: [PHP] forcing file downloads
| From: | Jared Boelens | Date: | Wed, 12 Jun 2002 13:12:53 +0000 |
| Subject: | RE: [PHP] forcing file downloads | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101725@lists.php.net to get a copy of this message | ||
20% represents a space.
-Jared
-----Original Message-----
From: Justin French [mailto:justin@indent.com.au]
Sent: Wednesday, June 12, 2002 9:01 AM
To: php
Subject: [PHP] forcing file downloads
I know this has been discussed many times, but I've been hunting through the
archives with very little resolution on the issue.
I've found the following note in the annotated manual:
> 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("");
1. Is this a widely accepted practice for forcing downloads (a pop-up window
to download a file), given the problems with older versions of IE?
2. Can someone tell me what the %20 is there for?
Regards,
Justin French
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php