/**
  * Upload file
  * @param File $model
  * @return bool
  */
 public function upload($model)
 {
     if ($this->validate()) {
         $model->name = FileHelper::removeExtension($this->file->name);
         $model->real_name = uniqid();
         $model->ext = $this->file->extension;
         $model->type = $this->file->type;
         $this->file->saveAs(FileHelper::getFilePath($model));
         return $model;
     } else {
         return false;
     }
 }
 /**
  * Display file
  * @param integer $id
  * */
 public function actionDisplayFile($id)
 {
     /** @var File $modelClass*/
     $model = $this->findFileModel($id);
     $file = FileHelper::getFilePath($model);
     if (file_exists($file)) {
         \Yii::$app->response->sendFile($file, $model->name . '.' . $model->ext, ['mimeType' => $model->type]);
     }
 }