php - Yii: How to make Dropzone Extension work? -


i'm trying add dropzone extension application in yii, allows asynchronous file uploading. http://www.yiiframework.com/extension/yii-dropzone/

the first thing did putting downloaded folder called "dropzone" extensions folder "c:\xampp\htdocs\site\protected\extensions".

and here code action in controller (maincontroller.php)

public function actionupload()  {      $test = rand(100000, 999999); //test      var_dump($test);        $model = new uploadfile;            if(isset($_files['images'])){                    $model->images = cuploadedfile::getinstancesbyname('images');                    $path = yii::getpathofalias('webroot').'/uploads/';                    //save images          foreach($model->images $image)          {              $image->saveas($path);          }                          }            $this->render('upload', array('model' => $model));  }

the view (upload.php)

<?php  $this->widget('ext.dropzone.edropzone', array(      'model' => $model,      'attribute' => 'images',      'url' => $this->createurl('file/upload'),      'mimetypes' => array('image/jpeg', 'image/png'),      'options' => array(),  ));  ?>

and model (uploadfile.php)

<?php    class uploadfile extends cformmodel  {      public $images;            public function rules(){          return array          (              array(                  "images",                  'file',                  'types' => 'jpg,gif,png',              ),          );      }  }

when run can see dropzone interface , can add images dragging them or selection them file explorer. appears respective progress bar , success mark, nothing appear in directory of uploads, , error shown neither in ide (netbeans) nor in chrome console.

i did print tests , realize code inside 'actionupload' being executed first time (when draws view), when called dropzone widget nothing.

i'd appreciate if have solution this. i'd love if give me simple working example of extension. thanks.

as understand, dropzone uploads files 1 one, not together. $model->images holds 1 image object. , foreach cycle fails.


Comments