merhaba,
aşağıdaki java fonksiyonla yereldeki dosyayı sunucuya upload ediyorum ama
upload esnasında upload hızını dosyanın yüzde kaçının yüklendiği gibi
bilgileri yazdırmak istiyorum. nasıl yapabilirim veya nasıl bir yol
izlemeliyim ?
teşekkür ederim.
public static void PostFile() {
try {
HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION,
HttpVersion.HTTP_1_1);
HttpPost httppost = new HttpPost("http://localhost/upload.php");
File file = new File("D:/sqldata.zip");
HttpEntity httpEntity = MultipartEntityBuilder.create()
.addBinaryBody("userfile", file, ContentType.create("application/zip"),
file.getName())
.build();
System.out.println(httppost.getRequestLine());
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);
}
}
--
ibrahim halil kurtgöz
[email protected]
http://kurtgoz.com
_______________________________________________
Linux-programlama mailing list
[email protected]
https://liste.linux.org.tr/mailman/listinfo/linux-programlama
Liste kurallari: http://liste.linux.org.tr/kurallar.php