when I choose file and send the form it show me
"Image cannot be blank."
Even that i choose image
this is the form Model
<?php
class AdminNewCatgory extends CFormModel
{
public $name, $image;
private $_identity;
public function attributeLabels()
{
return array(
);
}
public function rules()
{
return array(
array('name', 'length', 'allowEmpty' => false, 'min'=>4, 'max'=>30),
array(
'image', 'file',
'maxSize' => 2097152,
'types' => array('jpg','jpeg','png','gif','bmp'),
)
);
}
}
?>
the action in controller
public function actionCatgory($id=0)
{
if(!Admin::IsLogin())
throw new CHttpException(404);
if($id == 0)
{
// choose catgory
$catgories = Catgory::model()->findAll(array('order'=>'id DESC'));
$model = new AdminNewCatgory();
if(isset($_POST['AdminNewCatgory']))
{
$model->attributes = $_POST['AdminNewCatgory'];
if($model->validate())
{
}
}
$this->render('catgory_select+new',array(
'catgories'=>$catgories,
'model'=>$model
));
}
else
{
}
}
this is the view
<?php $form = $this->beginWidget('CActiveForm'); ?>
<div style="font-size:12px">
<?php echo $form->errorSummary($model,'<span style="font-weight:bold;">אנא תקן את השגיאות הבאות:</span>'); ?>
</div>
<br />
<b><?php echo $form->labelEx($model, 'name'); ?></b>
<?php echo $form->textField($model, 'name'); ?>
<br />
<b><?php echo $form->labelEx($model, 'image'); ?> <span style="color:#ff0000;font-size:10px">(JPG,JPEG,PNG,GIF,BMP)(גודל מקסימלי 2MB)</span></b>
<br />
<?php echo $form->fileField($model, 'image'); ?>
<br /><br />
<?php echo CHtml::submitButton('צור קולקציה'); ?>
<?php $this->endWidget(); ?>
thanks for help