Re: [PHP] Help w/ 'headers already sent' and file download

2006-05-16 Thread Mike Walsh

Rabin Vincent [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
On 5/16/06, Mike Walsh [EMAIL PROTECTED] wrote:

[ ... snipped ... ]


 Is there a way to both display a web page and send content to be saved by
 the user?  If someone knows of an example I could look at I'd be greatful.

No, you cannot display both a webpage and send a file
on the same page to the user.

What you could do is save the processed file in a temporary
folder and provide a link to download the file in your processing
statistics page. Or, you could redirect the user to the file after
showing the statistics page.

Rabin

[ ... snipped ... ]

I found a solution to my problem - an IFRAME with a 0 height and 0 width 
does the trick.

Here is a thread which helped: 
http://forums.invisionpower.com/index.php?showtopic=214649

Mike

--
Mike Walsh - mike_walsh at mindspring.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help w/ 'headers already sent' and file download

2006-05-16 Thread Richard Lynch
On Mon, May 15, 2006 10:48 pm, Mike Walsh wrote:
 Is there a way to both display a web page and send content to be saved
 by
 the user?

Not really really, but you can sort of hack it...

 If someone knows of an example I could look at I'd be
 greatful.

Send out the HTML for the stats, and bury a META tag something like:

META HTTP-EQUIV=REFRESH
CONTENT=0;http://example.com/cached_results.csv; /

Course, now you have to work out how to keep the CSV file around long
enough for it to download, and not criss-cross the files and purge
them when they are old and all that...

But it will sort of work like you think you want.

Another option would be to just display the stats and provide a
download link for right-click to get the CSV

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help w/ 'headers already sent' and file download

2006-05-15 Thread Rabin Vincent

On 5/16/06, Mike Walsh [EMAIL PROTECTED] wrote:

I have an application which I am working on which takes a file supplied by
the user via a File Upload, peforms some processing on it, then prompts the
user to download a generated CSV file.  What I would like to do is report
some processing statistics prior to the user prior to sending the CSV steam.

My CSV export ends with this:


header(Content-type: application/vnd.ms-excel) ;
header(Content-disposition:  attachment; filename=CSVData. .
date(Y-m-d)..csv) ;

print $csvStream ;

Unfortunately if I display any content prior to sending the CSV stream I get
the 'headers already sent' error message.

Is there a way to both display a web page and send content to be saved by
the user?  If someone knows of an example I could look at I'd be greatful.


No, you cannot display both a webpage and send a file
on the same page to the user.

What you could do is save the processed file in a temporary
folder and provide a link to download the file in your processing
statistics page. Or, you could redirect the user to the file after
showing the statistics page.

Rabin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php