Hello,
I encountered an unexpected behaviour when using sendFile to provide a download link for the users. I have the following (simplified) code in one of my controllers:
public function actionDownload()
{
$file = 'serverFile.pdf';
if(file_exists($file))
{
return Yii::app()->getRequest()->sendFile('myfile.pdf', @file_get_contents($file));
}
}
Now this code works well if the logging is desactivated. When I do this on my test version with logging on, the downloaded file has the right size, but is corrupted. If the logging is on, the first part of the file contains the logging information, and then only the actual pdf content (which is then truncated due to the size of the file).
Am I doing something wrong with the sendFile method or is this the expected behaviour?
I’m using yii 1.1.6.
Thanks for your help.
Regards,
Philippe