0

Is it possible to integrate multiple file upload in couchdb and yii?

If yes ,then how can implement ? And what are the issues will face while integrating multiple file upload in couchdb ?

soundari
  • 35
  • 1
  • 6

1 Answers1

1

Yes. This is how i make multiple upload in Yii.

public function actionCreate()
{
    $model=new Screens;
    if(isset($_POST['Screens']))
    {
        $model->attributes=$_POST['Screens'];
        if(isset($_FILES['screens'])){
            $images = CUploadedFile::getInstancesByName('screens');
            if(isset($images) && count($images)>0){
                foreach($images as $pic){
                    $model->setIsNewRecord(true);
                    $pic->saveAs(Yii::getPathOfAlias('webroot.images.games.screens').DIRECTORY_SEPARATOR.$pic);
                    $model->image=$pic->name;
                    $model->game_id=1;
                    $model->save();
                }
            }
        }
    }
    $this->render('create',array(
        'model'=>$model,
    ));
}

And my view:

     <?php
       echo "Screens";
       $this->widget('CMultiFileUpload', array(
          'model'=>$model,
          'name'=>'screens',
          'attribute'=>'image',
          'accept'=>'jpg|gif|png',
       ));
    ?>

Do not forget about enctype. Sorry but i dont now enything about couchdb. Im newbie in programing. Hope its help to you)