无法将更大(大小)的图像从 android 应用程序上传到数据库

Failed uploading larger (size) images from an android app to database

我正在调用我的 REST api 使用带有 POST 请求的球衣制作,我已将我的文件作为一个多部分实体

File file=new File(mImageUri.getPath());
MultipartEntity multipartEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); 

multipartEntity.addPart("image", new FileBody(file));

当图像尺寸相对较小(大约小于 1 mb)时,我的代码可以正常工作,但对于较大的图像会失败。

您必须将图片缩小到缩略图大小。

根据android documentation

For example, it’s not worth loading a 1024x768 pixel image into memory if it will eventually be displayed in a 128x96 pixel thumbnail in an ImageView.

阅读 this 所以 post。

这似乎是服务器端问题。检查服务器端是否设置了任何限制,因为默认情况下服务器端对上传图片或视频有限制,例如 2mb 或 3mb。