简体   繁体   English

如何将图像从Android保存到Java服务器

[英]How to save image from android to java server

I need to upload an image from android app to a java server. 我需要将图像从android应用上传到Java服务器。 I tried to define the type image like a string and to convert the image, that the user can upload from documents or take with camera, into a base64 string. 我试图像字符串一样定义类型图像,并将用户可以从文档上载或用相机拍摄的图像转换为base64字符串。 But when i convert this image in base64 and put this inside a string to save it in database, server give me a 500 internal sever error and this error message: "com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'image' at row 1" The Db is in Mysql and i use this from java server. 但是,当我在base64中转换此图像并将其放在字符串中以保存到数据库中时,服务器给我一个500内部服务器错误,并显示以下错误消息:“ com.mysql.jdbc.MysqlDataTruncation:数据截断:数据对于列而言太长第1行的“图像”” Db在Mysql中,我从Java服务器使用它。 So, how can I save a base64 image to my server? 那么,如何将base64映像保存到服务器? Can I use a different type? 我可以使用其他类型吗?

Thank you! 谢谢!

you can use volley library. 您可以使用排球库。 for more details these links are useful first_link and second_link 有关更多详细信息,这些链接是有用的first_linksecond_link

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM