Using php://output

Topics: Developer Forum, User Forum
Mar 22, 2011 at 9:25 AM

Hi!

I'm having trouble using "php://output" as save location for excel writer (I tried Excel5 and Excel2007).

The problem is that files saved when outputed to this special output are not readable. When I use a location on file system xls or xlsx file are writen correctly.

I used vbindiff to find difference between file outputed to php://output and then saved through browser (FF3.6.13 and Chromium browser) and file written directly to, say, /usr/tmp.

I found that there is one byte of difference at the beggining of the file saved through browser in both cases: hex 0A.

I have read the FAQ and the documentation and took care not to output anything else to buffer before or after calling writer's save method.

 

Where is the catch? What am I missing?

 

P.S.

My dev machine (web server) is as follows:

Ubuntu 10.10, PHPversion 5.3.3-1ubuntu9.3, running on lighttpd. 

Coordinator
Mar 22, 2011 at 9:47 AM
On 22/03/2011 09:25, mmesh wrote:

From: mmesh

I used vbindiff to find difference between file outputed to php://output and then saved through browser (FF3.6.13 and Chromium browser) and file written directly to, say, /usr/tmp.

I found that there is one byte of difference at the beggining of the file saved through browser in both cases: hex 0A.

0x0A is a line feed character. It looks like your script is outputting a single line feed somewhere. Watch out for blank lines after a closing ?>

---
Mark Baker