【发布时间】:2012-10-16 10:02:26
【问题描述】:
我正在尝试将MultiPartEntity 发送到服务器以上传图像。
我必须使用MultiPartEntity 向服务器发送数据,以下是示例请求。
{
"user": {
"id": "12345",
"primary_account_id": "43566"
},
"poster_photo": {
"title": "photo test",
"image": *uploaded image
}
}
有人知道怎么做吗?
请帮我解决这个问题。
【问题讨论】:
-
为什么不发送格式:MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("id", new StringBody("12345")); mpEntity.addPart("image", new FileBody(imageFile, "photo test"));
-
我试过了,但我需要在“user”标签内发送“id”,而“image”应该在“poster-photo”标签内。 @YogeshSomani
-
@Taruni 你检查我的答案了吗?
-
@Taruni 用于分段上传图片,请查看此链接stackoverflow.com/questions/4623507/…
标签: java android http multipartentity