作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在制作一个 android 应用程序,我在其中通过 xml 将图像从图库发送到服务器..任何类型的帮助将不胜感激......谢谢
最佳答案
这是我在我的应用程序中处理它的方式:
// bitmap is your Bitmap object
ByteArrayOutputStream stream = new ByteArrayOutputStream();
// The next line should be adjust to use the format and compression you want.
bitmap.compress(CompressFormat.PNG, 0, stream);
byte[] byteArr = stream.toByteArray();
// The next line would be where you write the byte array to your xml structure:
myXml += Base64.encodeBase64String( byteArr );
在我的应用程序中,byte[] 在创建 xml 结构之前作为 blob 保存到数据库中。所以这段代码并不是我正在做的。但它应该给你想法。
关于android - 通过httpmultipart向服务器发送图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7498086/
我有一个网络服务,它接收多部分文件(在c#中),当我通过chrome扩展(高级休息扩展)发送一个大文件(15MB)时,文件上传正常,我可以看到正文响应: blabla -9999 但是当我使
我是一名优秀的程序员,十分优秀!