Re: Re: Generating an Excel file?
| From: | Ben Ramsey | Date: | Tue, 20 Jan 2004 03:31:30 +0000 |
| Subject: | Re: Re: Generating an Excel file? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175101@lists.php.net to get a copy of this message | ||
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.
-Ben
daniel@electroteque.org wrote:
Alright. You've all given some great suggestions, and I'm going to track them down. But, for now, I'm settling for creating a CSV file. My next question: How do I get the file to download without the ".php" extension on the end? It's downloading it as "filename.csv.php". The code to right my headers is: header("Content-Type: text/comma-separated-values"); header("Content-Disposition: attachment; filename=$name.csv"); Do I need to add another header?Here is an edited function i did from the pear spreadsheet writer class function send($filename,$action=DOWNLOAD){header("Content-type: application/vnd.ms-excel"); switch ($action) { case 'DOWNLOAD':header("Content-Disposition: attachment;filename=$filename"); break;case 'OUTPUT':header("Content-Disposition: inline; filename=$filename"); header("Content-Description: PHP Generated Data"); break; } header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre- check=0"); header("Pragma: public");}