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 --- Vincent Jansen -----Original Message----- From: Williams, Olwen - SAL [mailto:[EMAIL PROTECTED] Sent: dinsdag 20 januari 2004 4:59 To: [EMAIL PROTECTED] Subject: RE: [PHP] Re: Generating an Excel file? Name it for example something.csv The in your .htaccess file put <Files something.csv> ForceType application/x-httpd-php </Files> Olwen Williams [EMAIL PROTECTED] -----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 4:43 PM To: Ben Ramsey Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Generating an Excel file? Ben Ramsey wrote: > Adding any of those headers still does not remove the ".php" from the > end of the file when I am prompted for the download. I have a client > that will be downloading this file, and I do not wish to instruct them > to first remove the ".php" extension before they can view it. Are you using IE? I think it has this annoying feature. 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 It doesn't matter what "dummy" is or "f.csv" is, so long as the entire URL ends in ".csv". Hopefully that'll work for you. All of the headers will remain the same. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ____________________________________________________________________ CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify Safe Air Ltd immediately. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Safe Air. _____________________________________________________________________ For more information on the Safe Air Group, visit us online at http://www.safeair.co.nz/ _____________________________________________________________________ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php