Re: FW: [PHP] Re: Generating an Excel file?
| From: | php at humbapa dot ch | Date: | Tue, 20 Jan 2004 16:19:25 +0000 |
| Subject: | Re: FW: [PHP] Re: Generating an Excel file? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175151@lists.php.net to get a copy of this message | ||
if you are using sessions:
remove session_start() inside the downloadscript
or play around with http-headers, e.g.:
session_start();
header("Expires: ".gmdate("D, d M Y H:i:s", 0)." GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: private, max-age:0");
header("Pragma: no-cache");
or download the file without the php-script and analyse the
http-headers with a network-sniffer
(http://www.ethereal.com)
g. martin luethi
Tue, 20 Jan 2004 10:14:29 -0500 Ben Ramsey <br@benandliz.com>:
John W. Holmes wrote: From what I've seen on here, the only workaround is to pass an extra variable in the URL that ends in ".csv", even though you don't need to use that variable. file.php?var=whatever&dummy=f.csv Olwen - Sal Williams wrote: Name it for example something.csv The in your .htaccess file put <Files something.csv> ForceType application/x-httpd-php </Files> Vincent Jansen wrote: I use header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header( "Content-type: application/x-excel" ); header( "Content-Disposition: attachment; filename=MyFile.xls" ); header( "Content-Description: PHP Generated Data" ); For me this works in both IE6 and Mozilla 1.5 None of these ideas seem to work. In fact, I don't think .htaccess files even work on a Windows server running IIS. But I could probably achieve the save results by playing with the extensions in IIS. At any rate, I tried it in IE6, and it prompts me to download it correctly and without the ".php" extension on the end. I had been trying it in Mozilla Firebird 0.7 prior to that. Since the client uses IE rather than Mozilla, then I won't worry about it for now. However, it still would be a good idea to find a way to resolve it. Any other ideas? Thanks, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php