From: Ali Asghar Toraby Parizy on
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
From: Michael Shadle on
On Fri, Apr 30, 2010 at 9:19 AM, Ali Asghar Toraby Parizy
<aliasghar.toraby(a)gmail.com> wrote:
> 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;
> ?>

We usually do something like this. Although I am not sure about text files.

header("Content-Disposition: attachment;
filename=\"".urldecode(basename($file))."\";");
header("Content-Type: application/force-download");