Android: Sending a byte[] array via Http POST

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 14:07:37
Fabio Falci

Take a look here Sending POST data in Android

But use ByteArrayEntity.

byte[] content = ...
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new ByteArrayEntity(content));           
HttpResponse response = httpClient.execute(httpPost);

You could base-64 encode your data first. Take a look at the aptly named Base64 class.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!