简体   繁体   中英

Base64 Image upload not working in iOS

I am building a phonegap application which requires image captured from camera to be uploaded to the server. I am using camera plugin to capture the image and sending the base64 string to the server.

This works fine in android but is causing problem in iOS. In iOS POST request is working fine in other instances where there is no image data involved. I have been using jquery to do handle the post requests.

I found one relevant discussion here talking about the memory usage. Can it be the reason behind this working in android but not in iOS? How do I reduce the memory usage and send the data at the same time.

Its better to go for multipart file uploading rather than uploading the file as string. In android also it will fail, if the image size is high.

you need to use MultipartEntity for this in client side. Google for more info.

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