I am trying to save an uploaded photo in my database using base64 but I can’t get the data:
Form:
<?php $form=$this->beginWidget('CActiveForm',
array(
'id' => 'upload-form',
'enableAjaxValidation' => false,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
));?>
<?php echo $form->fileField($model, 'attachment');?>
Controller:
$model->attributes=$_POST['Post'];
//gives me the filename
$model->attachment=CUploadedFile::getInstance($model,'attachment');
How do I get the contents so I can encode?
Do it like this: