文件预览时,调用的文件下载接口返回的文件路径文件类型改变
发布于 4 年前 作者 xiulan72 20284 次浏览 来自 问答

调用wx.downloadFile接口返回的临时文件类型改变了,请求的url接口后缀名为docx时返回的临时文件后缀名为.txt、请求的url后缀名为doc时返回的临时地址的后缀名为.wsword 。而请求的url后缀名为pdf时正常。

2 回复

我们也遇到了这个问题,明明是一个xlsx的文件,downloadfile下来变成了.txt;

刚刚后端解决了,url里的中文urlencode了一下,下载下来的临时文件后缀名就正常了,可以openDocument打开,你试试。

wx.downloadFile请求的url为“

http://www.runagain.cn/storage/enterprise/denso/insurance_manual.doc

”,

打印res结果为{tempFilePath: “http://tmp/wxc87b8248f01c07f2.o6zAJs4W109Gw0pNjhvR…X1MFzlSYBw1e59352bf3e8c336badec4b33eadee67.msword”, statusCode: 200, errMsg: “downloadFile:ok”},

这样调用wx.openDocument时报错信息:“openDocument:fail filetype not supported”

回到顶部