2

I want to send a picture from my mobile to my server, and i know how to send it using base64 but i've heard that base64 is not recommended to use because base64 encoding increases the size of image by 37%, which in case slows down the performance of server because there will be too many images shared by users on the server.

can anyone recommend me the efficient technique than base64 encoding for the mobile based image sharing application (client-server app)?

W.S
  • 931
  • 1
  • 10
  • 36
  • I'd be surprised if it really increased the size by 37%, but if you have a source for that, Id be pretty interested. As far as I can tell, it adds some escape characters, but other than that, I think base 64 is decently efficient – Jameo Feb 28 '13 at 21:43

2 Answers2

3

You could simply POST your image (in regular UTF-8 encoding) as explained here: NSData and Uploading Images via POST in iOS. You will need to have some server-side servlet or php page to decode the image and save it.

Community
  • 1
  • 1
Resh32
  • 6,500
  • 3
  • 32
  • 40
2

You can use FTP, for uploading and downloading images from iPhone. The main advantage of using FTP over other methods is that we can set the bytes width per second to certain limit and can detect how much data has been transferred till Particular event.

Here is the code given by apple documentation to illustrate the uploading and downloading of any data (image, pdf, video or audio anything) over FTP.

http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/CFFTPTasks/CFFTPTasks.html#//apple%5Fref/doc/uid/TP30001132-CH9-SW1

Also refer this PDF for better understanding

http://developer.apple.com/iphone/library/documentation/Networking/Conceptual/CFNetwork/CFNetwork.pdf

  • can you also tell all other possible techniques just for knowledge. and what are pros and cons of those? – W.S Aug 30 '12 at 05:06