Hi,
With Yii Framework, you can say good bye to ugly header code for forcing download a file on client side (I usually used for pdf files download forcibly) so that client browser should not try to open in in-built file handler.
1 2 | $request = Yii::app()->getRequest(); $request->sendFile('abc.pdf', file_get_contents(Yii::app()->basePath.'/files/mypdf')) |
As Per Yii Docs, this function takes care of all the headers required to accomplish the task. So all clean work now.