NYCPHP Meetup

NYPHP.org

[nycphp-talk] xls output: localhost works, www doesn't

Rick Retzko rick at click-rick.net
Wed Jan 16 06:25:30 EST 2008


Thanks for the recommendation!  I've got it working now (pointing the form
action directly to the file doing the processing, then exit() at the end of
the process), but I'd like to be A LOT more confident that I understand why
its working!
 
Can anyone point me to books/articles/tutorial that focus on how PHP
interprets headers or what's happening in the background when you download
from the server?
 
Thanks - 
 
Rick
============
MFR Holdings, LLC
rick at click-rick.net
201.755.4083
 

  _____  

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Adrian Noland
Sent: Tuesday, January 15, 2008 8:18 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] xls output: localhost works, www doesn't


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 <mailto: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

_______________________________________________
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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080116/b558626c/attachment.html>


More information about the talk mailing list