使用阿里云oss,javascript-SDK, 官方文档上传文件(基于node.js),总是提示如标题一样的问题;
官方文档地址:https://help.aliyun.com/document_detail/32068.html?spm=5176.doc32171.6.351.hCAxUH
源代码app.js:
var uploadFile = function (client) {
var file = document.getElementById('file').files[0];
var key = document.getElementById('object-key-file').value.trim() || 'object';
console.log(file.name + ' => ' + key);
return client.multipartUpload(key, file, {
progress: progress
}).then(function (res) {
console.log('upload success: %j', res);
return listFiles(client);
});
};
用源代码上传时报一种错误 :
“InvalidPart
One or more of the specified parts could not be found or the specified entity tag might not
have matched the part's entity tag.
57553B1B803284DD53402AE4
tougub.oss-cn-beijing.aliyuncs.com
undefined
1
7FB47CF327BC4AC9B7B9E8BC35C99F57
”
经过搜索。我把client.multipartUpload 换成了client.put() 就出现如标题一样的问题;
求专业大拿,帮助~ I need you help~~~ QQ :381976100
将文件转换成buffer
var reader = new window.FileReader()
reader.onload = (e) => {
vm.uploadFile = new Buffer(e.target.result)
}
reader.readAsArrayBuffer(file)
client.multipartUpload 文件超过100KB 报One or more of the specified parts could not be found or the specified entity tag might not have matched the part's entity tag.的解决方法 https://yq.aliyun.com/ask/41126/
我也有同样的问题!!!
POST http://xxx-xxx.oss-cn-hangzhou.aliyuncs.com/test/1.mp4?uploadId=8396FFB628714FD592DD4E21DCE4BA5E 400 (Bad Request)
aliyun-oss-sdk-4.4.4.min.js:4 Uncaught (in promise) Error: One or more of the specified parts could not be found or the specified entity tag might not have matched the part's entity tag.
at o.<anonymous> (http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js:4:16188)
at i (http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js:6:23661)
at u._invoke (http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js:6:25098)
at u.e.(anonymous function) [as next](http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js:6:23840)
at i (http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js:6:23661)
at u._invoke (http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js:6:24720)
at u.e.(anonymous function) [as next](http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js:6:23840)
at a (http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js:9:25589)
================================================================================
希望早日解决
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。