I try to applaud the bitmap through the retrofit to the server and get an empty response. Here is the request in the POST url HTTP / 1.1 Host: host Cache-Control: no-cache Postman-Token: 08814ad9-e705-977f-6225-29e3ed81eaee Content-Type: multipart / form-data; boundary = ---- WebKitFormBoundary7MA4YWxkTrZu0gW
---- WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name = "post_image"; filename = "undefined" Content-Type: undefined
---- WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name = "galleryId"
1156 ---- WebKitFormBoundary7MA4YWxkTrZu0gW
retrofit interface itself
@Multipart @POST("/api/web/v1/gallery/upload-gallery-image-multipart") Call<Object> uploadImage(final @PartMap Map<String, RequestBody> post_image);
and request
StreamContent streamContent = new StreamContent (mBitmap); Map _requestMap = new HashMap <> (); MediaType mediaType = MediaType.parse ("multipart / form-data");
_requestMap.put(String.format("%s\"; filename=\"%s", "\"post_image\"", "12345677"), new ContentRequestBody(streamContent)); _requestMap.put("galleryId", RequestBody.create(MediaType.parse("multipart/form-data"), "1682")); RetrofitAdapter.getInterface().uploadImage(_requestMap) .enqueue(new Callback<Object>() { @Override public void onResponse(Response<Object> response) { Log.d("DENYSYUK", "onResponse"); } @Override public void onFailure(Throwable t) { Log.d("DENYSYUK", "onFailure = " + t.getMessage()); } });