hi
I would upload files to the server with this function.
2 second intervals, How do I print the transferred data size ?
public void PostFile() { try { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); File file = new File("D:/data.zip"); HttpPost httppost = new HttpPost("upload.php"); HttpEntity httpEntity = MultipartEntityBuilder.create() .addBinaryBody("userfile", file, ContentType.create("application/zip"), file.getName()) .build(); httppost.setEntity(httpEntity); System.out.println("executing request " + httppost.getRequestLine()); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); System.out.println(response.getStatusLine()); if (resEntity != null) { System.out.println(EntityUtils.toString(resEntity)); } if (resEntity != null) { resEntity.consumeContent(); } httpclient.getConnectionManager().shutdown(); } catch (Exception e) { System.out.println("hata: "+e); } }