Yii XsendFile() not work

I have been trying Xsendfile() method in Yii over 20 times and none of them gave me a result. Here is my code:


$file_path = "D:/xampp/htdocs/mywebapp/protected/modules/file_upload".DS.

                  'views'.DS.'upload'.DS.testfile.".pdf"; 

    Yii::app()->request->xSendFile($file_path ,array(

       'saveName'=>$result['gen_name'] .".pdf",

       'mimeType'=>'application/pdf',

       'terminate'=>true,

     ));

And despite changing the location of testfile.pdf everywhere on my hard drive, none of them works. I am nearly exhausted with this method. Anyone could help me from being headache? I am using windows and xampp 1.7.4. Thanks so much!

check the manual here

Thank you for your respond Francis!

Base on your answer, and also collecting some other sources, I feel that CHttpRequest::sendFile() would be much easier. But I hardly find any example with pdf file, as I send pdf file to user when they click a button.

Could you help me a little with this?

Thank in advance.