1

We are developing a inspection application for iPad, where user can select multiple images from iPad and upload this images to portal, also he can enter comments on each particular image.

We are using xml for communication and converting images into base64 string format and uploading to server.

When xml size reaches around 2 MB, at the server side xml is not received and tomcat server returns Null Pointer Exception.

It will work fine if xml size is less than 2 MB. So i would like to know is converting images to base64 is a proper way to upload images to server?

Is there any size limit for uploading data from iPad/iPhone Application?

Any help is really appreciated.

prasad
  • 1,976
  • 2
  • 28
  • 51
  • convert image in Base64 Formate from this [http://stackoverflow.com/questions/12108496/how-can-i-convert-uiimage-to-base64-string/12110123#12110123][1] [1]: http://stackoverflow.com/questions/12108496/how-can-i-convert-uiimage-to-base64-string/12110123#12110123 – Vishal Aug 24 '12 at 13:30

3 Answers3

0

hi just compress your image

NSData *imageData = UIImageJPEGRepresentation(theImage, 0.1f);  

This compress your image and then convert it to base64..

Rajneesh071
  • 30,846
  • 15
  • 61
  • 74
  • yes we are using same, but may be the issue is with base64 conversion and size limit. – prasad Aug 24 '12 at 07:58
  • `UIImageJPEGRepresentation` will not convert data to base64 – Maulik Aug 24 '12 at 08:00
  • yes i am using this [Matt Gallagher](http://cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html) approach to convert image into base64 – prasad Aug 24 '12 at 08:10
0

Use ASIHTTP framework for uploas an image from mobile to server use the below link for how to upload image http://allseeing-i.com/ASIHTTPRequest/How-to-use don't forgot to add asihttp framewok to your app

user1587432
  • 39
  • 1
  • 6
  • hi do you want to say that the issue is with base64 conversion and I should use ASIHTTPRequest? – prasad Aug 24 '12 at 08:00
0

We have used PUT for HTTPMethod instead of POST and it worked properly, But I am not sure if there are any disadvantage of using PUT.

prasad
  • 1,976
  • 2
  • 28
  • 51