Sloaix / qiniu4js

🔥七牛上传SDK(浏览器环境)
MIT License
162 stars 34 forks source link

上传非图片的文件好像不可以?还是要配置什么 #22

Closed excxapp closed 7 years ago

excxapp commented 7 years ago

如题不知道,上传是否要配置什么?

Sloaix commented 7 years ago

有错误日志吗

excxapp commented 7 years ago

找到原因了,看你源码,里面,你都用了blob,这样阻碍获得upptoken this.resolveImageInfo = function (blob, s) { var widthRe = /\$(imageInfo.width)/; var heightRe = /\$(imageInfo.height)/; if (!widthRe.test(s) && !heightRe.test(s)) { return Promise.resolve(s); } // return new Promise(function (resolve) { // var img = new Image(); // img.src = URL.createObjectURL(blob); // img.onload = function () { // s = s.replace(widthRe, img.width.toString()); // s = s.replace(heightRe, img.height.toString()); // resolve(s); // }; // }); };

去掉下面这些,就没有任何问题了

Sloaix commented 7 years ago

刚才测试了,直传和分片上传非图片都没有问题。

Sloaix commented 7 years ago

测试文件15m,一个rar包。image image

如果还有问题,麻烦贴一下详细上传代码:)