PHP Laravel-下载具有其他大小的返回ZIP文件

时间:2019-02-18 16:05:04

标签: php laravel laravel-5 lumen

我正在使用Lumen 5.5。

用户可以下载存储在S3上的zip文件,PHP将执行以下操作

  1. 将文件从S3下载到localhost。
  2. 将下载的文件发送给用户。

我的功能是

public function downloadFile(request $request)
{
    $localpath = S3Manager::download($request->s3Key);
    return response()->download($localpath);
}

正在下载文件的其他尺寸,我无法在Mac上将其解压缩,出现以下错误:

Unable to expand file "filename.zip" into "Downloads"
Error 1: Operation not permitted.

这很奇怪,因为在Linux机器(后端)上,我可以轻松地将其解压缩。我还检查了浏览器中的Content-Length,从服务器返回的响应具有正确的长度(与S3中相同),但是下载的文件大小几乎是原来的两倍。

在前端,我正在使用js-file-download软件包

 https://www.npmjs.com/package/js-file-download

我不确定是什么问题。

0 个答案:

没有答案