specific file validation

Hi every one,

i want to add a validation rule for uploading a file :

upload can accept any file extension except aspecefic list of extensions.

for example : i can upload any type of file except .exe

i look into documentation and i found that we can just give lis of file extensions that can be accepted.

Any one have an idea ?

use a custom validator




//rules

array('myFile', 'myValidator')




public function myValidator()

{ 

   $valid=strpos($this->myFile,'.exe')===false;

   //use some kind of validation above

   if(!$valid)

      $this->addError('myFile', 'invalid extension');

}