aliyun / aliyun-oss-cpp-sdk

Aliyun OSS SDK for C++
Other
188 stars 88 forks source link

上传直接从内存创建的二进制文件出错 #51

Closed tooyamk closed 5 years ago

tooyamk commented 5 years ago

class membuf : public std::streambuf { public: membuf(char* p, size_t n) { setg(p, p, p + n); } };

auto buf = new membuf(new char[n], n); auto content = std::make_shared(buf); AlibabaCloud::OSS::PutObjectRequest request(BucketName, Key, content); client.PutObject(request);

返回的信息是code:ParseXMLError,msg:XML_ERROR_MISMATCHED_ELEMENT

我尝试直接用stringstream上传字符串是正常的,但是不知道这个二进制上传哪里出的问题

huiguangjun commented 5 years ago

你可以参考一下 https://github.com/aliyun/aliyun-oss-cpp-sdk/issues/12