Must provide String/Buffer/ReadableStream for put-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

Must provide String/Buffer/ReadableStream for put

投顾邦 2016-06-06 17:00:21 7983

使用阿里云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

JavaScript 对象存储
分享到
取消 提交回答
全部回答(4)
  • 1548038042022325
    2019-07-17 19:29:02

    将文件转换成buffer
    var reader = new window.FileReader()

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

    reader.readAsArrayBuffer(file)

    0 0
  • 1436603296521776
    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/

    1 0
  • 35550014
    2019-07-17 19:29:02

    我也遇到了,有人解决了吗?

    0 0
  • jeffrey_阳光
    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)

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

    0 0
添加回答
+ 订阅

时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

推荐文章
相似问题
推荐课程