0
我在寫doInBackground
下面的代碼,發送多個圖像路徑到服務器?
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);
問題是,當我派multiple image(s)
到server
,只有第一個圖像(for e.g, 23457352.jpg)
派遣有些則沒有。
任何人都可以幫我解決這個問題嗎? 在此先感謝...
是你的完整代碼嗎?你已經關閉了'try'和'if'語句。 –