title: i can't upload image using retrofit
body: <p>I am trying to register the user with an image using post method, the user has registered but the image not uploaded and no error.</p>
  
  <p>I saw many similar problems but didn't get the solution.</p>
  
  <p>The image uploaded successfully from chrome extension rest api request and HTML form.</p>
  
  <p>my code is below...</p>
  
  <pre><code>@Multipart
  @POST("webservicename")
  Call&lt;Login&gt; userUpdate1(@Part("device_id") RequestBody deviceid,
                          @Part("ip_address") RequestBody ipaddress,
                          @Part("user_id") RequestBody userid,
                          @Part("profile_images") MultipartBody.Part profile_images,
                          @Part("bdate") RequestBody bdate,
                          @Part("mangal_sani") RequestBody mangal_sani,
                          @Part("spect") RequestBody spect,
                          @Part("merried_status") RequestBody merried_status,
                          @Part("name") RequestBody name,
                          @Part("height") RequestBody height,
                          @Part("weight") RequestBody weight,
                          @Part("qualification") RequestBody qualification,
                          @Part("occupation") RequestBody occupation,
                          @Part("income") RequestBody income,
                          @Part("native") RequestBody nativeplace,
                          @Part("father") RequestBody father,
                          @Part("mother") RequestBody mother,
                          @Part("brothers") RequestBody brothers,
                          @Part("sisters") RequestBody sisters,
                          @Part("fincome") RequestBody fincome,
                          @Part("about_me") RequestBody about_me,
                          @Part("address") RequestBody address,
                          @Part("email") RequestBody email,
                          @Part("mobile") RequestBody mobile,
                          @Part("phone") RequestBody phone,
                          @Part("job") RequestBody job,
                          @Part("age") RequestBody age);
  </code></pre>
  
  <p>my image upload coding is below</p>
  
  <pre><code>  private void imageupload() {
      final ProgressDialog pDialog = new ProgressDialog(getActivity());
      pDialog.setIndeterminate(true);
      pDialog.setMessage("Loding...");
      pDialog.setCancelable(false);
      if (!pDialog.isShowing()) {
          pDialog.show();
      }
      File file;
      if (selectedFilePath.length() &gt; 0) {
          file = new File(selectedFilePath);
      } else {
          file = new File(imagename);
      }
  
      RequestBody reqFile = RequestBody.create(MediaType.parse("image/jpeg"), file);
      MultipartBody.Part body = MultipartBody.Part.createFormData("profile_images", file.getName(), reqFile);
      RequestBody email = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edemailid.getText().toString());
      RequestBody mobile = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edmobileno.getText().toString());
      RequestBody name = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edname.getText().toString());
      RequestBody occupation = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edoccupation.getText().toString());
      RequestBody qualification = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edqualification.getText().toString());
      RequestBody bdate = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.eddob.getText().toString());
      RequestBody father = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edfathername.getText().toString());
      RequestBody mother = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edmothername.getText().toString());
      RequestBody sisters = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edsistername.getText().toString());
      RequestBody brothers = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edbrothersname.getText().toString());
      RequestBody fincome = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edfamilyincome.getText().toString());
      RequestBody job = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edjob.getText().toString());
      RequestBody income = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edincome.getText().toString());
      RequestBody height = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edheight.getText().toString());
      RequestBody weight = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edweight.getText().toString());
      RequestBody address = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edaddress.getText().toString());
      RequestBody phone = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edphone.getText().toString());
      RequestBody mangal_sani = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edmangalsani.getText().toString());
      RequestBody age = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edage.getText().toString());
      RequestBody spect = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edspector.getText().toString());
      RequestBody about_me = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.edaboutMe.getText().toString());
      RequestBody merried_status = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.spmerridstatus.getSelectedItem().toString());
      RequestBody nativeplace = RequestBody.create(MediaType.parse("text/plain"), updateprofileBinding.ednativeplace.getText().toString());
      RequestBody DeviceId = RequestBody.create(MediaType.parse("text/plain"), generateID());
      RequestBody IpAddress = RequestBody.create(MediaType.parse("text/plain"), getIpAddress());
      RequestBody Userid = RequestBody.create(MediaType.parse("text/plain"), UserId);
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl(url)
              .addConverterFactory(GsonConverterFactory.create())
              .build();
      ApiInterface service = retrofit.create(ApiInterface.class);
      Call&lt;Login&gt; req = service.userUpdate1(DeviceId, IpAddress, Userid, body, bdate, mangal_sani, spect, merried_status, name, height, weight, qualification, occupation, income, nativeplace, father, mother, brothers, sisters, fincome, about_me, address, email, mobile, phone, job, age);
      req.enqueue(new Callback&lt;Login&gt;() {
          @Override
          public void onResponse(Call&lt;Login&gt; call, Response&lt;Login&gt; response) {
              // Do Something
              Login mLoginObject = response.body();
              String returnedResponse = mLoginObject.status;
              String msg = mLoginObject.msg;
              String Userid = mLoginObject.user_id;
              if (pDialog.isShowing()) {
                  pDialog.dismiss();
              }
              if (returnedResponse.trim().equals("1")) {
                  Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
              }
              if (returnedResponse.trim().equals("2")) {
                  Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
              }
              if (returnedResponse.trim().equals("3")) {
                  Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
              }
              if (returnedResponse.trim().equals("4")) {
                  Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
              }
              if (returnedResponse.trim().equals("0")) {
                  Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
              }
          }
  
          @Override
          public void onFailure(Call&lt;Login&gt; call, Throwable t) {
              t.printStackTrace();
          }
      });
  }
  </code></pre>