jszip - JSZip 错误:文件路径的 Ajax 错误:404 Not Found
问题描述
当我部署并尝试下载时,它说找不到文件
Error: Ajax error for /Areas/Client/UploadedFiles/2327/Driveshaft.dwg : 404 Not Found
Failed to load resource: the server responded with a status of 404 (Not Found)
当我上传 jpq 或 pdf 时,它工作正常,但 .dwg 文件出错
该文件存在,它说找不到。可能是因为 .dwg 格式。
function zipFiles(file_paths, zipFileName, id) {
var zip = new JSZip();
var count = 0;
file_paths.forEach(function (url) {
JSZipUtils.getBinaryContent(url, function (err, data) {
if (err) {
//throw err;
showNotification(err);
}
count++;
if (data != null) {
zip.file(url, data, { binary: true });
if (count == file_paths.length) {
debugger
zip.folder('' + uploadedDirectory+'' + id+'/')
.generateAsync({ type: 'blob' }).then(function (content) {
debugger
saveAs(content, zipFileName);
});
}
}
});
});
}
错误:文件路径的 Ajax 错误:404 Not Found
解决方案
如果您无法直接在 Web 浏览器中打开文件,则可能是服务器端配置“错误”。Dwg 是一种不常见的 mimetype,因此默认情况下您的 Web 服务器上可能未启用它。如果您的主机是 iis 服务器,请参阅ERROR 404.3 Not Found for JSON 文件以添加新的 mimetype。对于 dwg,我认为它是“image/vnd.dwg”,但我不确定 100%。
推荐阅读
- json - 为什么 JSON 路径对 WSO2 ESB 5.0 的 JSON 请求无效
- vba - VBA 中的 SABR 模型隐含波动率
- sql - 用左连接模拟内连接
- activemq - ActiveMQ 消息组消费者缓存
- html - Jekyll 内置 Sass 支持媒体查询生成
- git - Git:恢复被“git update-ref -d HEAD”删除的文件
- actionscript-3 - Adobe Flash 动作脚本 3
- amp-html - AMP 列表 - 如果我们没有收到 API 的响应,如何删除空格?
- typescript - 使用 `function f();` 语法进行记忆
- python-3.x - Python - 尝试使用 Selenium 登录网站时出现 urllib3 MaxRetryError