Check Type Of Image When Upload Image

Hi all.

My model Books:

I declare


public $image;

In function rules :


array('image', 'file', 'allowEmpty'=>true, 'types'=>'jpg,jpeg,gif,png'),

And my View :


 <div class="row">

        <?php echo $form->labelEx($model,'image'); ?>

        <?php echo $form->fileField($model, 'image'); ?>

        <?php echo $form->error($model,'image'); ?>

    </div>

When i upload images,It cant check type image.

Pls Help me.

Thanks all!

is it uploading?

set header of the form like this




<?php $form=$this->beginWidget('CActiveForm', array(

	'id'=>'configurations-form',

	'enableAjaxValidation'=>true,

	'htmlOptions'=>array('enctype'=>'multipart/form-data'),

)); ?>



this is working for me


public $uploadedFile;




array('uploadedFile', 'file', 'types'=>'jpg, png','maxSize'=>1024*60),