H
H
hollanditkzn2017-06-02 13:09:40
Yii
hollanditkzn, 2017-06-02 13:09:40

It is not clear how the image is downloaded?

I have such a problem that when you click on downloading a file, it comes out like this, but it does not download the file, but exits. Error status 206 Partial Content
77b2db41db424187abfd31337fc9f9ef.png
I have this in my code

<?= DetailView::widget([
        'model' => $model,
        'attributes' => [
[
                'attribute' => 'img',
                'format' => 'raw',
                'value' => $model->img == null ? null : Html::a($model->img, '@web/attachment/'.$model->img, ['download' => true])
            ],
            [
                'attribute' => 'maket',
                'format' => 'raw',
                'value' => $model->maket == null ? null : Html::a($model->maket, '@web/maket/'.$model->maket, ['download' => true]),
                'visible' => $model->maket != null
            ],
 ],
    ]) ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-06-02
@hollanditkzn

Judging by the screenshot, your DetailView is wrapped in Pjax, and this is the problem. All links in a container open inside it by default.... add the data-pjax="0" attribute to links to open links outside the container, for example:

Html::a($model->maket, '@web/maket/'.$model->maket, [
    'download' => true,
    'data-pjax' => 0
])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question