Filefield Validation

I am new to yii and taking over a project from someone else :)

So we have

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

  array('photo', 'file', 'types'=>'jpg, gif, png', 'on'=>'create'),

for the rules.

Now our form is spread over three steps.

The photo upload field is on the last one.

There is a javascript snippet called when clicking on submit and next

(on each step), which triggers validation by calling .blur() on each input.

Works fine.

The problem is, when my photo is empty, it will output immediately

the error message below the input field.

But when I try to upload a file with a not-allowed extension (e.g. tiff),

this kind of validation is not running.

Instead looks like the form gets submitted, and only then

I get redirected again, unluckily to the first step, which is quite annoying.

How can I prevent the form to be submitted if the file extension is not correct?