Hi ter,
IM newbie to yii framework,
currently im doing registration form to make user upload their own photo & preview it before save into database.
pls provide me guidelines how to do this.
Thanks
Hi ter,
IM newbie to yii framework,
currently im doing registration form to make user upload their own photo & preview it before save into database.
pls provide me guidelines how to do this.
Thanks
[color="#006400"]/* Moved from "Miscellaneous" to "General Discussion for Yii 1.1.x" */[/color]
Hi
$form->fileField($model, 'image', array('maxlength' => 255));
$form = $this->beginWidget('CActiveForm', array(
'id' => 'regular-form',
//'action'=>'addspecialevent',
'enableAjaxValidation' => false,
'enableClientValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => false,
//'afterValidate' => "js:afterValidate",
),
'stateful' => false,
'htmlOptions' => array('enctype' => 'multipart/form-data')
));
3)and then upload image on controller code
$model->image = CUploadedFile::getInstance($model, 'image');
$model->image->saveAs('upload/coupon/'.$model->image);
Hope it may helpful
Hi modi,
first of all thanks for ur reply.
I found the solution based on this URL:
its really works for me.
Anyhow thanks again.