Upload Multiple Image With Same Name As Array Retrofit 2.0.0-beta2
Hello guys i am using retrofit with android and also laravel 5.1 for file uploading on the server side now the problem i am facing is that in retrofit i want to send multiple image
Solution 1:
I would be happy and delighted if this could help you as well.
Server API contract : Input Type : Multipart-from data
Data to be send in body against key called "images"
@POST("feeds")
Call<> createFeeds(@Body RequestBody file);
MultipartBody.Builderbuilder=newMultipartBody.Builder();
builder.setType(MultipartBody.FORM);
builder.addFormDataPart("content", textContent);
for(String filePath : imagePathList){
Filefile=newFile(filePath);
builder.addFormDataPart("images", file.getName(),
RequestBody.create(MediaType.parse("image/*"), file));
}
MultipartBodyrequestBody= builder.build();
Call<SocialCreateFeedResponse> call = mSocialClient.createFeeds( requestBody);
Post a Comment for "Upload Multiple Image With Same Name As Array Retrofit 2.0.0-beta2"