Reputation: 3547
I want to make a download link for files stored in my webapp directory, so when the user click a link the file should be downloaded, here is my code:
$src= Yii::app()->request->baseUrl;
$url2 = $src."/CVs/resumes/".$m->idJob."-".$m->cv;
$url = Yii::app()->getRequest()->sendFile( $m->cv , file_get_contents( $url2 ) );
echo"<tr><td style='border:4px solid;border-color: black;text-align: center;'>".
CHtml::link($m->fullName, array('submit'=>$url))."</td></tr>";
I got an error that there is no such file or directory, where is the wrong?
Upvotes: 1
Views: 3511
Reputation: 1726
Try removing the third line and changing the last line to CHtml::link($m->fullName, $url2)."</td></tr>";
Please, let me know if it works.
Upvotes: 2