Example #1
0
 public function actionOff()
 {
     $model = \app\models\SysOnoffUpload::findOne(1);
     $model->status = 'off';
     $model->update();
     return $this->redirect(['site/index']);
 }
Example #2
0
use yii\helpers\Html;
//use yii\widgets\ActiveForm;
use kartik\widgets\ActiveForm;
// or yii\widgets\ActiveForm
use kartik\widgets\FileInput;
//use kartik\widgets\ActiveForm; // or yii\widgets\ActiveForm
//use kartik
/* @var $this yii\web\View */
/* @var $model app\models\Uploadallcdc */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="uploadallcdc-form">
    <?php 
$onof = \app\models\SysOnoffUpload::findOne(1);
if ($onof->status === 'on') {
    ?>
        <?php 
    $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
    ?>
        <?php 
    echo $form->field($model, 'file')->fileInput();
    ?>
        <?php 
    /*
              echo $form->field($model, 'file')->widget(FileInput::classname(), [
              'options' => ['accept' => '*'],
              'pluginOptions' => ['allowedFileExtensions' => ['zip']]
              ]); */
    ?>