How to Force IE to download text file?
| From: | Ali Asghar Toraby Parizy | Date: | Fri, 30 Apr 2010 16:19:38 +0000 |
| Subject: | How to Force IE to download text file? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-304785@lists.php.net to get a copy of this message | ||
I have written this code to export data to a text file and asks user
to save generated file. It works with Firefox perfectly, but IE shows
content of file instead of prompting the download window.
How can I force IE to show the download dialog?
<?php
Header("Content-disposition: attachement; filename=data.txt");
Header("Content-type: text/plain");
echo $some_data;
?>
--
Ali Asghar Torabi