/** * Creates a new PartnerSite model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new PartnerSite(['scenario' => 'insert']); if ($model->load(Yii::$app->request->post())) { $model->icon_file = \yii\web\UploadedFile::getInstance($model, 'icon_site'); $model->icon_site = $model->icon_file->baseName . '.' . $model->icon_file->extension; if ($model->save()) { return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('create', ['model' => $model]); } }