开发者社区> 问答> 正文

Must provide String/Buffer/ReadableStream for put

使用阿里云oss,javascript-SDK, 官方文档上传文件(基于node.js),总是提示如标题一样的问题;

官方文档地址:https://help.aliyun.com/document_detail/32068.html?spm=5176.doc32171.6.351.hCAxUH

1
2
源代码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

展开
收起
投顾邦 2016-06-06 17:00:21 19341 0
4 条回答
写回答
取消 提交回答
  • 将文件转换成buffer
    var reader = new window.FileReader()

      reader.onload = (e) => {
        vm.uploadFile = new Buffer(e.target.result)
      }

    reader.readAsArrayBuffer(file)

    2019-07-17 19:29:02
    赞同 展开评论 打赏
  • 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/

    2019-07-17 19:29:02
    赞同 1 展开评论 打赏
  • 我也遇到了,有人解决了吗?

    2019-07-17 19:29:02
    赞同 展开评论 打赏
  • 我也有同样的问题!!!

    我的问题:不是上传所有图片文件时,而是上传某些图片及 .mp4 文件时,报得和版主一样的错:

    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)

    ================================================================================
    希望早日解决

    2019-07-17 19:29:02
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Sketching Data With T-Digest 立即下载
Why you should care about data layout in the file system 立即下载
Path to 400M* Members: LinkedI 立即下载

相关实验场景

更多