[英]Upload an image / bitmap through HTTP from Android
I want to upload a bitmap to a php server through HTTP / POST. 我想通过HTTP / POST将位图上传到php服务器。 I saw some solutions, which used base64 encoding to POST the image, but in my eyes this approach seems a bit inconsistent.
我看到了一些解决方案,这些解决方案使用base64编码对图像进行POST,但是在我看来,这种方法似乎有点不一致。 Are there better ways to upload the image?
有上传图片的更好方法吗?
Best regards, Lukas 最好的问候,卢卡斯
在您的帖子中使用FileEntity 。
If you are using bitmap class, then change the value of 100 如果使用的是位图类,则将值更改为100
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
else place your code. 否则放置您的代码。
hope this work. 希望这项工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.