problem in file uploading

I try to make an upload form. But something is going wrong. When I enter a rule in the model, I do get a message: Please fix the following input errors: Image cannot be blank. Although I did select a file, on a windows machine, called test.jpg in the root. When I delete the rule I do get another message: Fatal error: Call to a member function saveAs() on a non-object

Any idea?

Please clear your question. But did you add this in your model rule?:


array('image', 'file', 'types'=>'png, jpg, jpeg, gif', 'allowEmpty' => false, 'on' => 'insert'),

also, in required field, image should not be added. image or file should not be added like this


array('user_name, email, image', 'required'),

please i would like to hear from you. <tanim>

Have you set the multipart element of the form?