validator issues for upload video

I have a little upload form and it works for JPG’s. Here is the model.

class UploadForm extends CFormModel {

    public $image;


    public function rules() {

        return array(

            array('image', 'file', 'types' => 'jpg, gif, png, mp4, ogg, MP4, OGG'),




However, I can not get it to upload videos. It always comes back wit the error message:

[html]The file "movie.mp4" cannot be uploaded. Only files with these extensions are allowed: jpg, gif, png.[/html]

Size is not the issue. When I rename movie.mp4 to movie.jpg, it uploads just fine. I thought rules determined what the validator what allows. But apparently that is controlled from somewhere else.

How do I get this to work for MP4 and OGG video files?

Postscript: What I wrote above is not correct. When I upload the movie renamed as movie.jpg, I do not get any error message. Also, the file passes validation in my controller.

However, the file is not actually being uploaded… >:(

In my model declaration, i used ‘file’ instead of your ‘image’.

Did you tried this?

You are right. It seems to work fine, as long as I replace ‘image’ with ‘file’ in the model, the view (i.e. the form) and the controller.

However, I am still confused why. Image or file should be just the name of an attribute. I did not expect that name to be of consequence…

I guess I am still missing something. :huh: