/**
  * @return boolean
  */
 public function upload()
 {
     if ($this->validate()) {
         if (Yii::$app->controller->module->databaseStorage === true || Yii::$app->controller->module->databaseStorage !== false && Yii::$app->controller->module->webAccessUrl === false) {
             $this->_model = new StorageItem();
             $this->_model->mime_type = $this->file->type;
             $this->_model->file_path = $this->getFileName();
             if (!$this->_model->save()) {
                 return false;
             }
         }
         if (!$this->file->saveAs(Yii::$app->controller->module->getFilePath($this->getFileName()), true)) {
             $this->_model->delete();
             return false;
         }
         return true;
     }
     return false;
 }