title: Retrofit 2 Send array of images to server
body: <p>I`m tring to send of array images to server wih other methods like  @PartMap or @Part("avatars_attributes[]"). But without result. Maybe you can help me?</p>
  
  <p>For @PartMap I use HashMap with some content:</p>
  
  <pre><code>        for(int i = 0; i &lt; images.size(); i++){
                  Bitmap btm = images.get(i);
                  ByteArrayOutputStream out = new ByteArrayOutputStream();
                  btm.compress(Bitmap.CompressFormat.JPEG, 50, out);
                  byte[] profilePictureByte = out.toByteArray();
                  final RequestBody imageBody = RequestBody.create(MediaType.parse("image/*"), profilePictureByte);
                  map.put("avatars_attributes[]\"; filename=\"avatars_attributes" + i + ".png\"",imageBody);
  </code></pre>
  
  <p>and </p>
  
  <pre><code>@Multipart
  @POST(ApiRetrofitUrls.TRANSPORTS_URL)
  Call&lt;TransportEntity&gt; addTransport(@PartMap() Map&lt;String, RequestBody&gt; map);
  </code></pre>
  
  <p>but on server received only empty array avatars_attributes[];</p>
  
  <p>In another way, I use  ArrayList of RequestBody or RequestBody[],</p>
  
  <p>but result is the some. </p>
  
  <p>Thanks.</p>