/**
  * Creates a new documento model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new documento();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // get the instance of the uploaded file
         $imageName = $model->nombre;
         $model->file = UploadedFile::getInstance($model, 'file');
         $model->file->saveAS('uploads/' . $imageName . '.' . $model->file->extension);
         //save the path in the DB
         $model->link = 'uploads/' . $model->nombre . '.' . $model->file->extension;
         $model->fecha = date('Y-m-d h:m:s');
         $model->save();
         return $this->redirect(['view', 'id' => $model->id_documento]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }