七牛 savekey php,七牛云存储 - Android SDK v7.0.3 saveKey 没有返回资源名key

陈霄
2023-12-01

My putPolicy is:

coffeescope: CONFIG.qiniu.scope

deadline: Math.floor(nextMonth.getTime() / 1000)

endUser: "#{ appId }/#{ userId }"

saveKey: '$(endUser)/$(x:targetId)/$(x:timestamp)'

returnBody: '{\"key\":$(key)}'

detectMime: 1

Android code, I use SDK 7.0.3:

javaUploadManager manager = new UploadManager();

Map params = new HashMap();

params.put("x:targetId", message.getRecipient());

params.put("x:timestamp", getTimestampString(new Date()));

final UploadOptions opt = new UploadOptions(params, null, true, null, null);

manager.put(filePath, null, token, new UpCompletionHandler() {

@Override

public void complete(String key, ResponseInfo info, JSONObject responseObject) {

LogUtil.info(LogUtil.LOG_TAG_CHAT, "Upload file finished with key: " + key + ", info: " + info);

}

}, opt);

I can successfully upload image, but there is no key return, below is the log message:

Upload file finished with key: null, info: {ResponseInfo:com.qiniu.android.http.ResponseInfo@3e1293b1,status:200, reqId:wRIAAFC1CzaRn9cT, xlog:s.ph;s.ph;s.ph;PFDS;PFDS;PFDS:1;PTFDM;PFDT;s.gh;PFDS/613;PTFDM:1;PTFDS;rdb.g/no such key;DBD/404;DBG/404;v4.exist:1/Document not found;rs12_6.ins:1;qtbl.ins:2;mc.s;RS:3;rs.put:4;UP:14, xvia:null, host:upload.qiniu.com, ip:null, duration:0.034000 s, error:null}

The JavaScript SDK can get key, Where do I wrong?

 类似资料: