Upload file with Retrofit 2
<p>I trying to do that a few days, and I really did everything..
Here is how request looks in Postman:
<a href="https://i.stack.imgur.com/6bEWf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6bEWf.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/lNxSh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lNxSh.png" alt="enter image description here"></a></p>

<p>I am sure, that all GET parameters were writing correctly. The problem in how I sending a file to upload, I suppose.</p>

<pre><code>            Map&lt;String, RequestBody&gt; map = new HashMap&lt;&gt;();
            File file = new File("/storage/emulated/0/ConstructSecure/d1940b05-76d1-4d98-b4b4-b04b8247c8cb.png");
            RequestBody requestBody = RequestBody.create(MediaType.parse("image/png"), file);
            String fileName = file.getName();
            map.put("attachment\"; filename=\"" + fileName + "\"", requestBody);

            //GET parameters
            Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
            params.put("inspectionUUID", inspectionUUID);
            params.put("noteUUID", noteUUID);
            params.put("attachmentUUID", attachmentUUID);
            params.put("noteType", noteType);
            params.put("modifiedTime", modifiedTime);

            Call&lt;ResponseBody&gt; call = service.upload(access_token,params,map);
            call.enqueue()....
</code></pre>

<p>Interface:</p>

<pre><code>@Multipart
    @POST("api/MediaFiles/AddMediaFile")
    Call&lt;ResponseBody&gt; upload(
            @Header("Authorization") String authorization,
            /* GET params */ @QueryMap Map&lt;String, String&gt; params,
            @PartMap Map&lt;String, RequestBody&gt; map
    );
</code></pre>

<p>Could anyone help me ?</p>