title: Found error 'Response{protocol=http/1.1, code=404, message=Not Found, url=url}' when sending file through retrofit2
body: <p>I am facing problem when sending file through retrofit2. But the web api working fine on Postman hit. Error Stated in responsebody:</p>
  <blockquote>
  <p>Response{protocol=http/1.1, code=404, message=Not Found, url=MYURL}</p>
  </blockquote>
  <p><strong>Retrofit2 endpoint:</strong></p>
  <pre><code>@Multipart
  @POST(&quot;FileStorage/UploadDataFile&quot;)
  Call&lt;ResponseBody&gt; uploadFile(@Part MultipartBody.Part file,@Part(&quot;file&quot;) RequestBody name);
  </code></pre>
  <p><strong>Updated code:</strong></p>
  <pre><code>// Uploading File
      private void uploadFile() {
  
          File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) +
                  File.separator + &quot;dbBackup&quot;+
                  File.separator +&quot;gps_db_4522_190122114644.sqlite&quot;);
            //File file = new File(mediaPath);
          Retrofit retrofit = RetrofitSingleton.getInstance(getActivity().getBaseContext());
          final CommonApiInterface commonApiInterface = retrofit.create(CommonApiInterface.class);
  
            RequestBody requestBody = RequestBody.create(MediaType.parse(&quot;*/*&quot;), file);
          MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData(&quot;file&quot;, file.getName(), requestBody);
          RequestBody filename = RequestBody.create(MediaType.parse(&quot;text/plain&quot;), file.getName());
  
          commonApiInterface.uploadFile(fileToUpload,filename).enqueue(new Callback&lt;ResponseBody&gt;() {
              @Override
              public void onResponse(Call&lt;ResponseBody&gt; call, Response&lt;ResponseBody&gt; response) {
                  if(response.isSuccessful()) {
                      Toast.makeText(getActivity(), &quot;Saved Successfully...&quot;, Toast.LENGTH_SHORT).show();
                  }
  
              }
  
              @Override
              public void onFailure(Call&lt;ResponseBody&gt; call, Throwable t) {
                  Toast.makeText(getActivity(), &quot;Save Fail: &quot; + t, Toast.LENGTH_SHORT).show();
              }
          });
      }
  </code></pre>