byte[] imagedata = baos.toByteArray();
String key = "http://7xqac7.com1.z0.glb.cddn.com/aa.png";
//凭证token
String toKen = "v5moXq4telhg9lX1nRhjcWtBZ-Ztz_iks";
// 重用 uploadManager。一般地,只需要创建一个 uploadManager 对象
try {
UploadManager uploadManager = new UploadManager();
uploadManager.put(imagedata, key, toKen,
new UpCompletionHandler() {
@Override
public void complete(String key, ResponseInfo info, JSONObject res) {
// res 包含hash、key等信息,具体字段取决于上传策略的设置。
Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
}
}, null);
} catch (Exception e) {
e.printStackTrace();
}
你上传报什么错呢?提供下具体的报错信息