File file = new File(filePath);
FileBody fileBody = new FileBody(file);
JSONObject jsonPayLoad = new JSONObject();
jsonPayLoad.put(KEY, "value");
..........
MultipartEntity multiPartEntity = new MultipartEntity();
multiPartEntity.getContentType();
multiPartEntity.addPart(KEY_FILE,fileBody);
multiPartEntity.addPart(KEY_STRING<span style="font-family: Arial, Helvetica, sans-serif;">, new StringBody("value", Charset.forName("UTF-8")));</span>
multiPartEntity.addPart(KEY_JSON,new StringBody(jsonPayLoad.toString(),Charset.forName("UTF-8")));
AsyncCallBackInterface asyncHanlder = new AsyncCallBackInterface() {…….};
RequestBody requestBody = new RequestBody(multiPartEntity,..........);
RESTClient.GetInstence().sendRequest(requestBody);
文件同数据一起上传,
不管是什么类型multPartEntity.addPart(KEY, value),都按照string来传