Dear Rick,

Adrian's suggestion is a good one. I had this problem in a project (my first) summer before last. Just in case it would help, this is what worked for me:

header("Content-Disposition: inline; filename={$this->_file_name}");

header("Content-type: application/vnd.ms-excel; name='excel'"); header('Pragma: private');
header('Cache-control: private, must-revalidate');

header("Expires: 0");


Message: 8 Date: Tue, 15 Jan 2008 08:18:07 -0500 From: "Adrian Noland" <[EMAIL PROTECTED]> Subject: Re: [nyphp-talk] xls output: localhost works, www doesn't To: "NYPHP Talk" <talk@lists.nyphp.org> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Try an ob_clean() before sending the header. That way you make sure there are no extra LF/CR in your output. On 1/14/08, Rick Retzko <[EMAIL PROTECTED]> wrote:

>
> Hi all - Hopefully one of you have seen this and can quickly point me to
> the
> error of my ways.
>
> I need to output small files from mysql database to the user via excel
> files. I'm using the following class to do this:
>
> private function output_file(){
>                 //output the file to the user
>                 header("Content-Type: application/vnd.ms-excel;
> name='excel'");
>                 header("Content-Disposition: attachment;
> filename={$this->_file_name}");
>                 header("Pragma: no-cache");
>                 header("Expires:0");
>                 echo "{$this->_export_string}";
>                 exit();
>         }
>
> This works perfectly on localhost, but when I move it to my www site, it
> outputs the data onto the screen.
>
> I've tried using "header('Content-Type: application/octet-stream');" as
> well, with the same results.
>
> All help is appreciated!
>
> Best Regards -
>
> Rick
> ============
> MFR Holdings, LLC
> [EMAIL PROTECTED]
> 201.755.4083



begin:vcard
fn:Julia Sheehy
n:Sheehy;Julia
org:Vassar College;Administrative Information Services
adr;dom:;;C 221;Poughkeepsie;NY;12604
email;internet:[EMAIL PROTECTED]
title:Programmer/Analyst
tel;work:845-437-5939
note;quoted-printable:Raise money for your favorite charity or school just by searching the Int=
	ernet with GoodSearch - www.goodsearch.com - powered by Yahoo!=0D=0A=
	=0D=0A=
	
x-mozilla-html:FALSE
url:http://computing.vassar.edu/
version:2.1
end:vcard

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to