I whant to know if i and how i can store the whole file in my DB wich 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 | |
| filetyp | varchar(10) | NO | | NULL | |
+---------+-------------+------+-----+---------+----------------+
I managed to make a file upload Widget without any funktion behind it. It is possible to select a file and to press the Submit button. But thats it.
$form = $this->beginWidget(
'CActiveForm',
array(
'id' => 'upload-form',
'enableAjaxValidation' => false,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
)
);
echo $form->labelEx($model,'');
echo $form->fileField($model,'image');
echo $form->error($model,'image');
echo CHtml::submitButton('Submit');
$this->endWidget();
and now i dont know how to make a Controller Funktion that saves my file into my database. Where the "File"(DB filed) is the aktual kontent of the file the zname = the File name , date the aktual date of upload and filetype = the filetype.
For more information i had a question about downloading Files like that: Download link from Database BLOB with yii Framework