Ich habe den Code unten in doInBackground
, geschriebenSenden mehrerer Bild-Pfad zum Server?
InputStream in = null;
DefaultHttpClient httpclient = new DefaultHttpClient();
try {
System.out.println("calling API here");
HttpPost httppost = new HttpPost("my url");
MultipartEntity reqEntity = new MultipartEntity();
if (imageList != null) {
for(int i=0;i<imageList.size();i++) {
File f= new File(imageList.get(i));
in = new BufferedInputStream(new FileInputStream(f));
reqEntity.addPart("file[]",f.getName(), in);
}
}
reqEntity.addPart("mobile",owner_mobile);
reqEntity.addPart("reg_code",reg_code);
reqEntity.addPart("book_id",book_id);
reqEntity.addPart("adv_amount",advAmountValue);
httppost.setEntity(reqEntity);
HttpResponse response = httpclient.execute(httppost);
Das Problem ist, wenn ich multiple image(s)
zum server
schickte, nur erstes Bild (for e.g, 23457352.jpg)
senden andere nicht.
Kann mir jemand helfen, dieses Problem zu lösen? Vielen Dank im Voraus ...
Ist das Ihr vollständiger Code? Sie haben die Anweisungen "try" und "if" nicht geschlossen. –