I was wondering what the preferred way of sending an image to a webserver from an android application?
I开发者_JAVA百科've seen people
- opening up sockets and send the actual image data.
- base64 encoding it and sending it as a string.
What is the preferred way? Can someone post some examples as well.
Thanks
You could try writing it to an xml file as a base64 string then send it an parse the file on the server and decode the string to an image.
An HTTP Post is probably the easiest way, sending it as multi-part form data. Makes it easier to receive as well (a bog standard web server can handle it!)
精彩评论