Saturday, September 11, 2010

[android-developers] HTTP Multipart POST: data + text

Hello,

I would like to develop an application that uploads an image and some
text data about that image.
To do that, I am trying to create a HTTP Multipart Post, as follows:
[code]
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("servlet address");
FileBody file = new FileBody(new File("image file"));
StringBody text = new StringBody("text data");
MultipartEntity reqEntity = new
MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart("myFile", file);
reqEntity.addPart("textData", text);
[/code]

My doubt is: how can I extract those values in the server? I would
like to develop a Servlet to receive and process the post requests. In
this Servlet I would need to extract these values in th request.
Can you help me?
Do you have any sample of server to answer the android multipart
requests?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment