1

im trying to send a picture from a android device to a server and was wondering if it was possible to send the picture information in a xml file and rebuild it on the server?

Roy James Schumacher
  • 636
  • 2
  • 11
  • 27

3 Answers3

1

Yes, there is, you just have to use Base64 to encode and decode the file stream. To encode you'll use the android.util.Base64 class and at the server side (if you're also using Java) you can use the commons-codec Base64 class.

The idea would be build the xml file as with whatever tool you would like to:

<image>
  <user>username</user>
  <other-property>property</other-property>
  <data><-- here you'll add your base64 encoded image as a string -->
</image>

Once you do this, just upload the XML file itself to your server and parse the XML file in there.

Maurício Linhares
  • 39,901
  • 14
  • 121
  • 158
0

You should use a MultiPartPost. This SO answer is exactly what you are looking for.

Community
  • 1
  • 1
Ovidiu Latcu
  • 71,607
  • 15
  • 76
  • 84
0

you can user Base64to send your image as text, so you can put in xml file

Mohammad Ersan
  • 12,304
  • 8
  • 54
  • 77