I am using okhttp3
for upload image on server and i success in Upload image but i can not POST parameter with MultipartBody
my code is here..
File sourceFile = new File(sourceImageFile);
Log.logInfo("File...::::" + sourceFile + " : " + sourceFile.exists());
final MediaType MEDIA_TYPE_PNG = MediaType.parse("image/png");
OkHttpClient client = App.getInstance().getOkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart(KEY_ACCESS_TOKEN, accessToken)
.addFormDataPart(KEY_FILE, "profile.png", RequestBody.create(MEDIA_TYPE_PNG, sourceFile))
.build();
Request request = new Request.Builder()
.url(URL_IMAGE_UPLOAD)
.post(requestBody)
.build();
Response response = client.newCall(request).execute();
I want to add "key" and "value" by POST Method in above code So how can i do.