Image Validation With Out Page Load

I want to validate image extension…

suppose i only allowed ext are jpg,gif,png. when image upload, if allowed ext not available a message will show instantly in below.how can i do it…can any one help me… plz tell me with example.

hi shakil,

try this…>>>>>




array('image', 'file', 'allowEmpty'=>true, 'types'=>'jpg,jpeg,gif,png') //whatever type u want



or …

check this

i already used this…but i want after upload it will instantly check whether it is matches the types or not.

u understand now…can help now…i tried several link include u r give but doesn’t work

i already do it…but i dont want this way…i want, after image upload, it will instantly check, wheather it is allowed or not & a message will shoe in below…ok

Hi, Please try this


    	array('image_name','required','on'=>'create'), 

        

    	array('image_name', 'file', 'allowEmpty' => TRUE,'types' => 'jpg, jpeg, gif, png','on'=>'update'),



When you can create the new record use the


$model = new Model('create');

and update the record use the


$mdoel= new Model('update');

i tried it…it works…but which i want this is not…