[nycphp-talk] Re: xls output: -- from talk Digest, Vol 15, Issue 31
Julia Sheehy
jusheehy at vassar.edu
Wed Jan 16 10:32:44 EST 2008
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"
<anoland at indigente.net> Subject: Re: [nycphp-talk] xls output: localhost
works, www doesn't To: "NYPHP Talk" <talk at lists.nyphp.org> Message-ID:
<1d8a0e930801150518t35d76f4bg92522f9b8e12f418 at mail.gmail.com>
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 <rick at click-rick.net> 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
> > rick at click-rick.net
> > 201.755.4083
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jusheehy.vcf
Type: text/x-vcard
Size: 474 bytes
Desc: not available
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080116/64c8d93c/attachment.vcf>
More information about the talk
mailing list