i trying write program in android uploads file server. want use apache httpclient that.
here code:
string url = "http://192.168.1.103:8080"; file file = new file("/sdcard/alireza/ali.txt"); try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); inputstreamentity reqentity = new inputstreamentity(new fileinputstream(file), -1); reqentity.setcontenttype("binary/octet-stream"); reqentity.setchunked(true); // send in multiple parts if needed httppost.setentity(reqentity); toast.maketext(getapplicationcontext(),"executing...",toast.length_long).show(); httpresponse response = httpclient.execute(httppost); toast.maketext(getapplicationcontext(),"done",toast.length_long).show(); //do response... }catch (exception e){ } the done toast doesn't appear.
Comments
Post a Comment