title: org.apache.http.NoHttpResponseException: The target server failed to respond
body: <p>I am using the following code to post Image to server,but  it is giving error below</p>
  
  <p><strong>org.apache.http.NoHttpResponseException: The target server failed to respond</strong></p>
  
  <p>I did not understand whether the issue is from Server side or from my Code side.</p>
  
  <p>can anyone please help me in solving this issue?</p>
  
  <p>code:</p>
  
  <pre><code> protected Long doInBackground(URL... arg0) {
  
              CustomMultiPartEntity multipartContent = new CustomMultiPartEntity(
                      new ProgressListener() {
                          @Override
                          public void transferred(long num) {
                              publishProgress((int) ((num / (float) totalSize) * 100));
                          }
                      });
              try {
                  for (int i = Constants.IMAGE_SELECTION; i &lt; al_image_paths
                          .size(); i++) {
                      count = i + 1;
                      progressDialog.setProgress(0);
  
                      // String url=DataUrl.hostId+"/addpost/postImageOrVideo?";
                      HttpClient httpClient = new DefaultHttpClient();
                      HttpContext localContext = new BasicHttpContext();
                      HttpPost httpPost = new HttpPost(image_upload);
  
                      Log.e("strImagePath.... before uploading",
                              al_image_paths.get(i));
  
                      multipartContent.addPart("image", new FileBody(new File(
                              al_image_paths.get(i))));
                      multipartContent.addPart("sellleadid",
                              new StringBody(pref.getString("sellerID", "")));
                      multipartContent.addPart("action", new StringBody(
                              "Send Used Car Images"));
                      multipartContent.addPart("app_id", new StringBody(Constants.DEVICE_ID));
  
                      totalSize = multipartContent.getContentLength();
  
                      httpPost.setEntity(multipartContent);
  
                      HttpResponse response = httpClient.execute(httpPost,
                              localContext);
                      String serverResponse = EntityUtils.toString(response
                              .getEntity());
                      Log.e("serverResponse image", "&lt;&gt; " + serverResponse);
  
                      JSONObject object = new JSONObject(serverResponse);
  
                      if (object.getString("status").equals("200")) {
                          selectedImageIds.add(object.getString("imageid"));
                          selectedUrls.add(object.getString("url"));
                      }
                  }
              } catch (Exception e) {
                  e.printStackTrace();
              }
              return null;
          }`enter code here`
  </code></pre>