This is my code for CMultiFileUpload. Everything working fine except file saving in table only once. is there any saveAll() or something???
public function actionMultiplePhoto($id)
{
$model = new PropertyPhoto;
$file = CUploadedFile::getInstancesByName('location');
var_dump($file);
if(!empty($file))
{
foreach($file as $thefile)
{
echo $thefile->name;
$rnd = rand(0,9999);
$fileName = "{$rnd}-{$thefile}";
$model->location = $fileName;
$model->property_id = $id;
$model->status = 'waiting';
$model->save();
$thefile->saveAs(getcwd().'/picture/upload/'.$model->location);
}
}
$this->render('multiplePhoto',array('model'=>$model));
}
Thanks in advance