/**
  * Updates an existing DotaPlayer model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if (Yii::$app->request->isPost) {
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->imageFiles = UploadedFile::getInstances($model, 'imageFiles');
         //echo'<pre>';var_dump($model->imageFiles);echo'</pre>';die;
         if (count($model->imageFiles) != 0) {
             if ($model->upload()) {
                 $img_path = $model->path . '/' . $model->filename;
                 $img_dimentions = DImageHelper::getImageDimentions($img_path);
                 DImageHelper::processImage($model->path, $model->filename, 250, 250, $img_dimentions, true);
                 $model->foto = $model->filename;
             }
             $model->imageFiles = null;
         }
         //echo'<pre>';print_r($model);echo'</pre>';//die;
         if ($model->foto != $model->oldAttributes['foto'] && $model->oldAttributes['foto'] != '') {
             DFileHelper::deleteFile($model->oldAttributes['foto'], 'players');
         }
         $model->save(false);
         if (isset($_POST['save'])) {
             return $this->redirect(['index']);
         } else {
             return $this->redirect(['update', 'id' => $model->account_id]);
         }
     } else {
         //echo'<pre>';print_r($_FILES);echo'</pre>';//die;
         //echo'<pre>';print_r($model);echo'</pre>';die;
         return $this->render('update', ['model' => $model]);
     }
 }