I had given answer Uploading a large file in multipart using OkHttp but i am stuck with multiple image uploading.
I want to upload dynamically 1 to 10 image at a time.
RequestBody requestBody = new MultipartBuilder()
.type(MultipartBuilder.FORM)
.addFormDataPart(KEY_PHOTO_CAPTION, photoCaption)
.addFormDataPart(KEY_FILE, "profile.png", RequestBody.create(MEDIA_TYPE_PNG, sourceFile))
.build();
I have ArrayList
of PhotoCaption class which has captionPhoto
and urlPhoto
so how can i addFormDataPart()
I am thinking to make loop and call this function that many times of ArrayList size.
Is there any solution to addFormDataPart() use dynamically?