Optional Filefield

hi, i have a table assignment contains the following field

id, studentID, behaviorID, uploadFile

uploadFile is a file type

assignment model:

rules: array(‘uploadFile’, ‘file’, ‘types’=>‘docx, doc, pdf’),

in the create option, in _form

i put the fields: id, studentiD and behaviorID without the uploadFile

when i press create button, an error appears that the field uploadFile cannot be blank

in the database, i put the field uploadFile Null= true, and in the rules there is nothing indicates that it must be required. so i dont understand why this message still appears and the action creation doesnt happens?

can anyone help me?

thank you

NB: if i remove array(‘uploadFile’, ‘file’, ‘types’=>‘docx, doc, pdf’) from rules, the problem disappear, but i can upload any kind of files and that what i dont want. i just want the doc file types (montioned in the rule)

/* moved to General Discussion */

Just set allowEmpty parameter to true:


'allowEmpty' => true