[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP] How to Force IE to download text file?
From:       Michael Shadle <mike503 () gmail ! com>
Date:       2010-04-30 17:50:12
Message-ID: x2mbd9320b31004301050k52432969g6e9e596209cabfbd () mail ! gmail ! com
[Download RAW message or body]

On Fri, Apr 30, 2010 at 9:19 AM, Ali Asghar Toraby Parizy
<aliasghar.toraby@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");

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic