java - Android Multiple image upload not send data to server -
hello working android . want send multipart data asp.net server contains text , mulltiple images. can able send 1 image send server. used code
for(int i=0;i<captured_imagepath.size();i++) { file file2 = new file("my folder path" + captured_imagepath.get(i)); entitybuilder.addbinarybody(file2.getname(), file2, contenttype.create("image/jpeg"), captured_imagepath.get(i)); entitybuilder.setboundary(boundary); }
where captured_imagepath array list of image names in folder.i tried print sending data file , works fine in case when send 1 image, if used more 1 image, means if captured_imagepath has size >1 not print sending data , image not send server.is there problem code ? stucked problem. please me in advance :)
you can try this
` ( int i= 0; < size ; i++ ){ try { file file = new file("my folder path" + captured_imagepath.get(i)); inputstreamentity reqentity = new inputstreamentity( new fileinputstream(file), -1); reqentity.setcontenttype("binary/octet-stream"); reqentity.setchunked(true); //to send in multiparts httppost.setentity(reqentity) ; httpclient.execute(httppost); // can catch httpresponse here } catch ( exception e ) { e.printstacktrace() ; } }`
where file file var.
Comments
Post a Comment