处理android一半上传/损坏上传的图像到服务器 [英] Handle android half uploaded/broken uploaded images to server

查看:74
本文介绍了处理android一半上传/损坏上传的图像到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是场景,我只是从图库中打开照片或从相机 Intent 中捕获照片,然后使用将返回的图像转换为 base64 &使用 HttpClient/HttpPost 的标准代码,尝试将其上传到 RESTful Web 服务.在从我的 android 应用程序上传照片期间,设备的 Internet 连接丢失并且部分照片的 Base64 被上传时出现问题.所以图像在服务器上显示如下:

Here is the scenario, simply I'm opening a photo from gallery or capturing a photo from camera Intent, then using converting the returned image to base64 & using standard code of HttpClient/HttpPost, trying to upload it to a RESTful web service. problem appears when during photo upload from my android application, device's Internet connection is lost and parts of the photo's Base64 is uploaded. so image appears like this on the server:

有什么想法吗?

推荐答案

尝试检查服务器中图像的长度并将其与设备中图像的长度进行比较

Try to check the length of the image in the server and compare it to the length of the image in your device

这篇关于处理android一半上传/损坏上传的图像到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆