コード例 #1
0
ファイル: FilesController.php プロジェクト: vetal06/diplom
 /**
  * Creates a new Files model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Files();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id, 'user_id' => $model->user_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
ファイル: FilesController.php プロジェクト: chaimvaid/linet3
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Files();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     return $this->render('create', array('model' => $model));
 }
コード例 #3
0
ファイル: FilesController.php プロジェクト: phprocks/cadastro
 /**
  * Creates a new Files model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Files();
     if ($model->load(Yii::$app->request->post())) {
         // process uploaded image file instance
         $file = $model->uploadImage();
         if ($model->save()) {
             // upload only if valid uploaded file instance found
             if ($file !== false) {
                 $path = $model->getImageFile();
                 $file->saveAs($path);
             }
             Yii::$app->session->setFlash("file-success", '<i class="fa fa-check"></i> Arquivo anexado com sucesso!');
             return $this->redirect(['/solicitation/view', 'id' => $model->solicitation_id, '#' => 'checklist']);
         } else {
             // error in saving model
         }
     }
     return $this->render('create', ['model' => $model]);
 }