I'm totaly new to the Yii Framework and i don't understand the how to create a download link with a popup window that asks if you whant to save the file.
What i know and have till now:
- I know how the CHtml::link(...) works and already impelemted that.
- I extracted the Blob content form the db and saved it in a $data->file
- The link where i whant to click should be inside a CListView
My database USERZ looks like this
+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| file | blob | NO | | NULL | |
| USER_id | int(11) | NO | MUL | NULL | |
| zname | varchar(40) | NO | | NULL | |
| date | date | NO | | NULL | |
+---------+-------------+------+-----+---------+----------------+
my Controller funktion (SiteController.php)
public function actionVerwal()
{
$model2=new USERZ;
$this->render('verwal',array('model2'=>$model2));
}
and the view (verwal.php)
<?php
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$model2->a(Yii::app()->user->getId()),
'itemView'=>'_verwal',
));
//function a($id) just makes sure that the right user data is provided
The Part that i dont understand (_verwal.php):
<b><?php echo CHtml::encode($data->getAttributeLabel('Files')); ?>:</b>
<?php echo CHtml::link(CHtml::encode($data->zname), $data->file); ?>
<br />
How can i make the File name into a Link so it provides a download. I have all it needs the Content of the File and the Name but i dont know how to put them together and make them into 1 download file popup.