开发者

send Image byte data in json request in android?

I would like to send image byte data in Http Post in android and iPhone.

Let me know hoe to send Image data in JSON Like below JSON String

 {
 "Request": {
    "data": {
    "Key": "keydata",
    "info": {},
    "param": {
        "title": "Testingpostmultipartimageupload",
        "photo": **"IMAGE BYTE DATA"**,
        "photoFilenam开发者_运维技巧e": "Test.png"
    }
},
"info": {}
}

Thanks in advance,


ByteArrayOutputStream ba = new ByteArrayOutputStream();
    imageBitmap.compress(Bitmap.CompressFormat.PNG, 100, ba); 
    byte[] bmpbyte_sign = ba.toByteArray();

pass bmpbyte_sign. Hope will help u...


Dude just convert the image into the bytes then decode with this data with base64 string and pass that string in the json. BTW I'm from iPhone

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜