/** * Creates a new Document model. * If creation is successful, the browser will be redirected to the 'view' page. * * @return mixed */ public function actionCreate() { $model = new Document(); if ($model->load(Yii::$app->request->post())) { $uploaded = $model->uploadFile(); if ($uploaded) { if ($model->save()) { return $this->redirect(['index']); } else { $model->deleteFile(); } } //_p( $uploaded, 1); } return $this->render('create', ['model' => $model]); }