简体   繁体   中英

How to Upload Image to server using webservice in Android?

I have develop android app in which one UserProfile is there. I have send all details of user to server using Ksoap2. I also want to send image to server. But, i don't know how to send image to webservice using Ksoap2 in android.

I have take image from sdcard and convert it to ByteArray. Is there I have to send that parameter as ByteArray of image to webservice? I want to pass all details of user and image to webservice. How can I do this?

You can convert the your image into base64 string,and then handle them again to image at server side.

I tried following tutorial, you can also try it, android upload image to server .

You can send it as a Multipart file in a network call using retrofit 2 library. Kindly check this answer as a reference for detailed code snippet: https://stackoverflow.com/a/68511884/8391757

You can convert the your image into base64 string,and then handle them again to image at server side. but it getting a poor quality of image

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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