1

I need to send the multi parameter in form data while uploading a file to server on Android. I used this code for uploading a files to server. Here my doubt is how to send multi parameters in form data?

bharath
  • 14,283
  • 16
  • 57
  • 95
  • Holy crap, don't use that code. See [here](http://stackoverflow.com/questions/3038409/how-to-send-http-post-request-and-recieve-response/3038747#3038747) or [here](http://stackoverflow.com/questions/3919512/android-multipart-upload) etc. – Dave Newton Jan 06 '12 at 22:41

1 Answers1

1

You'll probably want to use the Apache HTTP client stuff. Put a List<NameValuePair> of your desired values into a UrlEncodedFormEntity, set it as the entity in an instance of HttpPost, and POST away.

Apache HTTP Client JavaDocs for Android are here.

Argyle
  • 3,324
  • 25
  • 44
  • @bharath I thought you wanted to send form data. There's a `ByteArrayEntity` and a `FileEntity` if that's what you want to send. And an `InputStreamEntity` if you don't necessarily want to load up everything in memory first. – Argyle Jan 07 '12 at 01:15