controllers/VehiculoController.php
/**
     * Creates a new Vehiculo model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
Creates a new Vehiculo model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Vehiculo model . If creation is successful the browser will be redirected to the ' view ' page . @return mixed
public function actionCreate()
    {
        $model = new Vehiculo();
        if ($model->load(Yii::$app->request->post())) {
            $model->file = UploadedFile::getInstance($model, 'file');
            $model->file->saveAs('carnet/' . $model->PLACA_CHUTO . '.' . $model->file->extension);
            $model->IMG_CARNET = 'carnet/' . $model->PLACA_CHUTO . '.' . $model->file->extension;
            $model->save(false);
            return $this->redirect(['view', 'id' => $model->ID]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
public function actionCreate ( ) { $ model = new Vehiculo ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { $ model -> file = UploadedFile :: getInstance ( $ model , 'file' ) ; $ model -> file -> saveAs ( 'carnet/' . $ model -> PLACA_CHUTO . '.' . $ model -> file -> extension ) ; $ model -> IMG_CARNET = 'carnet/' . $ model -> PLACA_CHUTO . '.' . $ model -> file -> extension ; $ model -> save ( false ) ; return $ this -> redirect ( [ 'view' , 'id' => $ model -> ID ] ) ; } else { return $ this -> render ( 'create' , [ 'model' => $ model , ] ) ; } }
Creates a new Vehiculo model.
Creates a new Vehiculo model .