コード例 #1
0
 /**
  * Creates a new Customers model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Customers();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->composer_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
 public function actionUploadform()
 {
     $model = new Customers();
     if ($model->load(Yii::$app->request->post())) {
         $model->file = UploadedFile::getInstance($model, 'file');
         if ($model->file) {
             $fileName = 'Customers';
             $model->file->saveAs('CustomersFile/' . $fileName . '.' . $model->file->extension);
             $this->readfile();
             die;
         }
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model, 'upload' => true]);
     }
 }