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