/** * Creates a new Solicitation model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Solicitation(); $model->status_id = 1; $model->created = date('Y-m-d H:i:s'); $model->ip = Yii::$app->getRequest()->getUserIP(); if ($model->load(Yii::$app->request->post()) && $model->save()) { // Create the ID folder $idfolder = $model->id; $idfolder = str_pad($idfolder, 6, "0", STR_PAD_LEFT); // add 0000+ID mkdir(Yii::getAlias('@upload') . "/" . $idfolder, 0777, true); return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }