how to download a zip file

ぃ、小莉子 提交于 2019-11-28 07:32:07
Buddy

I think you're setting the responseType in the wrong place, instead of this:

$http.post('/api/apiZipPipeLine/', model)

Try this:

$http.post('/api/apiZipPipeLine/', model, {responseType:'arraybuffer'})

Take a look at this answer for more details.

At a matter of fact you are rigth adding responseType:'arraybuffer'. That added to the following code when received the response from ajax will prompt a file to download:

var a = document.createElement('a');
var blob = new Blob([responseData], {'type':"application/octet-stream"});
a.href = URL.createObjectURL(blob);
a.download = "filename.zip";
a.click();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!