M
M
Max2020-05-23 15:18:20
Yii
Max, 2020-05-23 15:18:20

Why is there an error when downloading zip yii?

Hello, actually the problem is if you upload zip to the form.
I have already shoveled everything, I can’t understand what the problem is, BUT everything works on LAN.
the file is loaded into the Request Body, although as I understand it, it shouldn’t be like that ... because of this, the debug hangs hard.
post is empty.
I removed everything in the controller and it's still the same:

public function actionCreate()
    {
        $model = new MyModel();

        if ($model->load(Yii::$app->request->post())) {

            if ($model->save()) {
            }
            }

        return $this->render('create', [
            'model' => $model,
        ]);
    }


that is, there is not even a file handler as such, but for some reason the error

is the view with the form:

<?php $form = ActiveForm::begin(); ?>

    <?php if ($model->isNewRecord): ?>
        <?= $form->field($model, 'name')->textInput(['readonly' => false])->label('Название') ?>
    <?php else: ?>
        <?= $form->field($model, 'name')->textInput(['maxlength' => true, 'readonly' => true])->label('Название') ?>
    <?php endif; ?>
    <br>
    <?php if ($model->isNewRecord): ?>
    <?= $form->field($model, 'file')->fileInput()->label('Zip архив') ?>
    <?php endif; ?>

    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-05-24
@RozMakc

Since you are talking about the problem of working in different environments, then the problem in the environment is obvious.
I did not see in the code how you process zip.
I assume that the framework has nothing to do with it, but the problem lies on the server side. Look at the logs on the server. Perhaps the problem is in the php zip extension itself or the php init settings. It is on localhost but not on the server. But it is not clear why you have nothing in the logs. Maybe you don't notice...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question