作者:手机用户2502913375 | 来源:互联网 | 2023-10-11 12:18
RequestBodyfileBodyRequestBody.create(MediaType.parse(applicationoctet-stream),newFile(mnt
RequestBody fileBody = RequestBody.create(MediaType.parse("application/octet-stream"),
new File("/mnt/sdcard/Pictures/testhead.png"));
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("file", "testhead.png", fileBody)
.addFormDataPart("address", "test address")
.build();
HttpUtils.getHttpService().updateMyInfo(requestBody)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new ProgressSubscriber(mContext, mView) {
@Override
public void onSuccess(Object o) {
mView.onAddCheckSuccess();
}
});