I'm trying to set up a scenario in Yii. I have a model called File, which I use for a file upload. Now, I want to use the same model for the creation of directories. Directories don't have a file attribute so I setup the scenatio in the model like this:
public function rules()
{
return array(
array('file', 'file', 'types'=>'jpg, gif, png, jpeg, bmp', 'maxSize'=>1024 * 1024 * 10, 'tooLarge'=>'Bestand moet kleiner dan 10MB zijn.'),
array('file', 'file', 'on'=>'makefolder', 'allowEmpty'=>true),
);
}
In the controller I trigger the scenatio with $model = new File("makefolder");
Even now I always get the error that 'File cannot be blank'. I used this page as documentation.