/** * Creates a new Pics model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Pics(); if ($model->load(Yii::$app->request->post())) { if (isset($_FILES) && $_FILES) { $model->imageFile = UploadedFile::getInstance($model, 'imageFile'); if ($model->imageFile) { $model->upload(); } } else { die('eee'); } if ($model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { var_dump($model); die; } } else { return $this->render('create', ['model' => $model]); } }