For multiple image upload in yii we have to work in two files which are the following

  • The controller file
  • The view file

For controller file

public function actionCreate()
//loading the model
$model=new MultiFileUpload;
$images = CUploadedFile::getInstancesByName('images');
if(!file_exists(Yii::app()->basePath .'/images/username'))
mkdir(Yii::app()->basePath .'/images/username' ,777);
foreach ($images as $image => $pic) 
$ext = pathinfo($pic->name);
$models[$i] =new MultiFileData;
if ($pic->saveAs(Yii::app()->basePath .'/images/'.$username. 8 .'/'.$filename)) 
}	$i++;

For the view file

Your view file must be like this

Add multi upload element in view file and it will be like this