/** * Creates a new BLanguecenter model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { if (\Yii::$app->user->can('manage-languagecenter')) { $model = new BLanguecenter(); if ($model->load(Yii::$app->request->post())) { // process uploaded image file instance $image = $model->uploadImage(); $image_icon = $model->uploadImageIcon(); //die($model->image); if ($model->save()) { // upload only if valid uploaded file instance found if ($image !== false) { $path = $model->getImageFile(); $image->saveAs($path); } if ($image_icon !== false) { $path1 = $model->getImageFileIcon(); $image_icon->saveAs($path1); //die($model->getImageUrlIcon()); } print_r($model->errors); return $this->redirect(['view', 'id' => $model->ID]); } else { print_r($model->errors); } } return $this->render('create', ['model' => $model]); } else { throw new ForbiddenHttpException(); } }