Android HttpUrlConnection: Post Multipart Android HttpUrlConnection: Post Multipart spring spring

Android HttpUrlConnection: Post Multipart


Have you tried using the MultipartEntity method? I had the same problem when downloading big amounts of JSON data from the server, but I switched to this method and caught all the data that the server provided me.

HttpClient httpclient = new DefaultHttpClient();HttpPost httppost = new HttpPost("http://myurl.com");try {    MultipartEntity entity = new MultipartEntity();    entity.addPart("type", new StringBody("json"));    entity.addPart("data", new JSONObject(data));    httppost.setEntity(entity);    HttpResponse response = httpclient.execute(httppost);} catch (ClientProtocolException e) {} catch (IOException e) {} catch (JSONException e){}


For simple and easy to use, I recommend this lib https://github.com/koush/ion.I use it on my project and it works perfectly.