views:

165

answers:

1

I have a Zend Controller that serves files to users

I have used Noginn SendFile action helper to do the actual streaming of the file, but the code simply uses readfile($path) to place the content of the file into the buffer after setting the MIME and content type etc

The problem is that the file that arrives down the pipe has an extra blank byte 0x20 at the beginning, not a train smash for text files but obviously fatal for images

My controller has the following code in it to stop any view scripts from being rendered: $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); but I think a whitespace is still getting placed in the output buffer somewhere before the file is getting streamed. Is there a way to clear the output buffer before I stream the file?

Thanks is advance

+1  A: 

The answer is painfully obvious, now that I have had some coffee

ob_clean();

Gary Benade