Upload works, but MultipleUpload does not work!


I trying the Multiple upload things, I did the example in 106 single file upload, it works totally fine, then I try to multiple update files like code on page 109, it does not work. looks like there is validate problem, I always get $model->validate() false, with errors like this:

array(1) {


  array(1) {


    string(21) "File cannot be blank."



I am sure, I have choose 3 times file from disk, and click the upload button. I google some, but not find good solution, and btw. code on page 109:

$files = CUploadedFile::getInstance($model, 'file');

man should here use getInstance or getInstances? I am totally confused, Please help. Thank you very much.

Hi, it does not work for me too. i tried with the getInstances method, it returns an array of files, but it does not work also. The error is file cannot be blank.

you can use this: http://www.yiiframework.com/wiki/326/nice-file-upload-tool-on-yii-framework/

is very efficient, and easy to implement.

IN Upload.php

array(‘file’, ‘file’, ‘types’=>‘zip’,‘allowEmpty’ => true),

IN UploadController.php


IN view.php

<?php echo CHtml::activeFileField($model, "file[0]")?>

<?php echo CHtml::activeFileField($model, "file[1]")?>

This uploads the files but does no validation upon either of the files selected. Not a good solution. The author should comment how to fix this obviously this code hasn’t been tested before written in the book.

I got same problem.

Do anyone have a solution for this ?

hello my first response to the forum, always read he never contributes, c’mon

I to using a multiupload with multiple files

so do not know if it actually looked rather more follows the MVC pattern code


public function rules()


		return array(


	array('picture', 'pictureRule'),



	.. );




	public function pictureRule()





					  $this->addError('pictureRule', 'Error not file blank!');

				 	  return false;


					 return true;





*remember to put that part of the instance file after validation

* i use  [url="http://www.yiiframework.com/extension/euploadedimage/"]EUploadImage[/url] extension for good make thumbs

public function actionCreate()


$model=new Produts;






$picture = EUploadedImage::getInstancesByName('picture');


Try this -

array('imageList', 'file', 'types'=>'jpg, gif, png', 'allowEmpty' => true, 'maxFiles' => 10)