contao/test — Issue #2678: Controller::sendFileToBrowser and the output buffer
Author: aschempp
Created: 2011-11-29 10:06:01+00:00
State: open
Labels: Defect, framework

Apparently, the sendFileToBrowser() method does not work when an output buffer is active. The file is truncated after a few bytes (probably the buffer limit) and therefore corrupted.

I was able to solve this problem by calling ob_get_clean() before using sendFileToBrowser(). However, I think this could be handled directly in the Controller function to make it more reliable for developers. By adding a routine like this inside the function, the problem can be solved:

```
while( ob_get_clean() !== false ) {}
```

[Download the attachments](http://www.contao.org/tl_files/tickets/2678.zip "Download the attachments of this ticket")
Related issues: #2804

--- _Originally created on November 17th, 2010, at 09:56am (ID 2678)_