Hello together,
to validate a single file (a single input-file-field) is no problem in yii and it works very well:
public function rules() {
return CMap::mergeArray(parent::rules(), array(
array(
'image',
'file',
'allowEmpty'=>false,
'types'=>'pdf,jpg,gif,png',
'on' => 'CaseA, CaseB',
'maxSize'=>1024000,
'tooLarge' => 'Max File size is 1MB',
'message' => 'You have to upload a file at least'
),
....
....
What if image is an array of files? Created Form-Elements by yii looks like (Firebug-Output):
<input type="file" id="MyFormModel[image][0]" name="MyFormModel[image][0]">
<input type="file" id="MyFormModel[image][1]" name="MyFormModel[image][1]">
What exactly should I modify in my rules? A simple "image[]" does not help…
Thank you very much
rgds
eb