I am trying to upload image on web server, but whenever it tries it is sending me html source code as response and image is not uploaded there. My code is: HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); bitMap.compress(Bitmap.CompressFormat.JPEG, 100, byteStream); byte[] buffer = byteStream.toByteArray(); ByteArrayBody body = new ByteArrayBody(buffer,"profile_image"); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("b@gmail.com.jpg", body); post.setEntity(entity); System.out.println("post entity length "+entity.getContentLength()); ResponseHandler handler = new BasicResponseHandler() ; String response = client.execute(post,handler); Thanks in advance!!!