I would like to ask you how to upload video to the server with additional data (Multipart) For example : The user should send his name, Email, Phone number and video from gallery..... Thank you..
Asked
Active
Viewed 778 times
1 Answers
0
Try this Upload video from Android to server?
http://vikaskanani.wordpress.com/2011/01/11/android-upload-image-or-file-using-http-post-multi-part/
HttpClient httpClient = new DefaultHttpClient();
HttpPost postRequest = new HttpPost("http://w3mentor.com/Upload.aspx");
byte[] data = IOUtils.toByteArray(is);
InputStreamBody isb = new InputStreamBody(new ByteArrayInputStream(data),"uploadedFile");
StringBody sb1 = new StringBody("someTextGoesHere");
StringBody sb2 = new StringBody("someTextGoesHere too");
MultipartEntity multipartContent = new MultipartEntity();
multipartContent.addPart("uploadedFile", isb);
multipartContent.addPart("one", sb1);
multipartContent.addPart("two", sb2);
postRequest.setEntity(multipartContent);
HttpResponse res = httpClient.execute(postRequest);
res.getEntity().getContent().close();

Community
- 1
- 1

change_is_necessity
- 687
- 7
- 24
-
Thanks , put how to send entered data from the user such as Name, Email and Phone while sending video. – Dev Sep 28 '11 at 08:50
-
in the above code the "one"/"two" are actually the name, email value... i guess its clear now... – change_is_necessity Oct 03 '11 at 14:30