0
我想上傳圖片&用不同的名字發送。用不同的名字上傳文件
將圖像發送成功,但與原來的名稱:
httpPostuplod = new HttpPost(URL);
MultipartEntity multiPart = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
for (int i = 0; i < imglist.size(); i++) {
System.out.println(imglist.get(i));
File file = new File(imglist.get(i));
// multiPart.addPart("IMG_"+Constants_Fix.postImgcount+".png", new FileBody(new File(imglist.get(i))));
ContentBody cbFile = new FileBody(file, "image/png");
multiPart.addPart("IMG_"+Constants_Fix.postImgcount+".png",cbFile);
Constants_Fix.postImgcount++;
}
httpPostuplod.setEntity(multiPart);
HttpResponse resuplod = httpclient.execute(httpPostuplod);
然後更改名稱:文件名+號碼 – jennifer
忽略該代碼..我只是把代碼你要顯示如何附加圖像名稱的數字 – jennifer
數字的意思? – jennifer