Hi,
I need to enable file upload validation on clientside (to check file extension, maxsize, etc)
I tried setting ‘enableClientValidation’ => true, but no effect.
Here’s my code snippet
model rules:
array('uploadedfile1', 'file',
'allowEmpty'=>false,
'enableClientValidation' => true,
'types'=>'jpg,jpeg,gif,png',
'maxSize' => 1024 * 1024 * 1, // 1MB
),
in the view file:
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
'id'=>'users-form',
'type'=>'horizontal',
'enableClientValidation'=>true,
'enableAjaxValidation'=>false,
'clientOptions' => array(
'validateOnSubmit'=>true,
'validateOnType'=>false,
'validateOnChange'=>false,
)
));
....
<?php echo $form->fileFieldRow($model, 'uploadedfile1'); ?>
....
?>
Any Help? Thanks
fyi: there is no uploadedfile1 field in the database, it’s just a variable in the class