Hi to all , i m a new user and i m learning a bit , but i need your help
I have a form where users upload a file and store it in uploading folder --> it works
but now i would like in view page to show a link where users can dowload file uploaded by others
i made my actionDownload in my controller TesiController.php
public function actionDownload($file) {
$myfilepath= dirname(__FILE__) . '/../upload/';
$filecontent = file_get_contents($myfilepath . $name);
header("Content-Type: application/pdf");
header("Content-disposition: attachment; filename=$name");
header("Pragma: no-cache");
echo $filecontent;
exit;
}
and in view
<?php echo CHtml::link($data->title,array('tesi/download',
'file'=>$data->tesifile)); ?>
<br />
Unfortunately the file downloaded has 0byte , what i wrong?