Laravel 图像未在浏览器中下载

问题描述

我的代码有什么问题? 当我在浏览器的检查元素中观看预览时,我可以在预览部分看到图像。但图片没有下载。

    $name = $result['name'];
    $path = $result['path'];
    
    $disposition = HeaderUtils::makedisposition(ResponseHeaderBag::disPOSITION_ATTACHMENT,$name,str_replace('%','',Str::ascii($name)));

    return \Response::download($path,[
        'Content-Type' => 'image/png','Content-disposition' => $disposition
    ]);

浏览器响应标头在这里

Accept-Ranges: none
Cache-Control: public
Connection: close
Content-disposition: attachment; filename=e7853e60982911eb912b2192bf4aa5360341.png
Content-Length: 5095
Content-Type: image/png

this is the sample image response in web browser

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)