title: upload photo with retrofit2: retrofit: 2.0.0-beta4
body: <p>I have problem with upload photo on server with uses retrofit 2.Can somebody help me? what i did wrong? my back-end dev has sad me that boundary in header didnt generate =(
   this is my interface:</p>
  
  <pre><code>import retrofit2.http.Headers;
  import retrofit2.http.POST;
  import retrofit2.http.Part;
  import retrofit2.Call;
  import retrofit2.http.Multipart;
  import okhttp3.MultipartBody;
  import com.google.gson.JsonElement;
  
  public interface Retrofitv2Api {
      @Multipart
      @Headers("Content-Type: multipart/form-data;")
      @POST("/mobile/v1/classifieds/UploadImage")
      Call&lt;JsonElement&gt; UploadImage(@Part MultipartBody.Part body,@Part("uniqId")String uniqId,@Part("token")String token);}
  </code></pre>
  
  <p>builder:</p>
  
  <pre><code>import retrofit2.Retrofit;
  import retrofit2.converter.gson.GsonConverterFactory;
  
  public class RetrofitV2Config {
      private  static Retrofit getRetrofit(){
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl("http://api.qrz.ru")
              .addConverterFactory(GsonConverterFactory.create())
              .build();
          return retrofit;
      }
  
      public static Retrofitv2Api getService(){
          return getRetrofit().create(Retrofitv2Api.class);
      }
  </code></pre>
  
  <p>and upload fragment:</p>
  
  <pre><code>String photoPath = photoAdapter.getPhotoPaths().get(0);
                  File image = new File(photoPath);
  
  
                  RequestBody imageBody = RequestBody.create(MediaType.parse("image/*"), image);
  
                  MultipartBody.Part body =  MultipartBody.Part.createFormData("file", image.getName(), imageBody);
  
  
                  RetrofitV2Config.getService().UploadImage(body , "2536654", Token.getSavedToken()).enqueue(new Callback&lt;JsonElement&gt;() {
                      @Override
                      public void onResponse(Call&lt;JsonElement&gt; call, Response&lt;JsonElement&gt; response) {
                          Log.i(Logger.TAG, "onResponseUpload " + response.body() + " " + response.code());
                      }
  
                      @Override
                      public void onFailure(Call&lt;JsonElement&gt; call, Throwable t) {
                          Log.i(Logger.TAG, "onFailureUpload");
                      }
                  });
  </code></pre>
  
  <p>backend ansver:</p>
  
  <pre><code>21:34:32.386117 IP 46.37.203.69.50461 &gt; 62.181.46.35.http: Flags [P.], seq 1184070465:1184071311, ack 3418438796, win 65535, length 846
  E..v.o@.5....%.E&gt;..#...PF.{A..&lt;.P...]...POST /mobile/v1/classifieds/UploadImage HTTP/1.1
  Content-Type: multipart/form-data
  Content-Length: 647
  Host: api.qrz.ru
  Connection: Keep-Alive
  Accept-Encoding: gzip
  User-Agent: okhttp/3.2.0
  
  --950f42dd-12a1-4e11-a3b0-826ddaf41aa3
  Content-Disposition: form-data; name="img"
  Content-Transfer-Encoding: binary
  Content-Type: application/json; charset=UTF-8
  Content-Length: 2
  
  {}
  --950f42dd-12a1-4e11-a3b0-826ddaf41aa3
  Content-Disposition: form-data; name="uniqId"
  Content-Transfer-Encoding: binary
  Content-Type: application/json; charset=UTF-8
  Content-Length: 8
  
  "215132"
  --950f42dd-12a1-4e11-a3b0-826ddaf41aa3
  Content-Disposition: form-data; name="token"
  Content-Transfer-Encoding: binary
  Content-Type: application/json; charset=UTF-8
  Content-Length: 22
  </code></pre>