How to send png images from iPhone to web service - iphone

I have been trying to send .png images from iPhone to web service. I have come so fas as converting the .png image into a byte[] array. I am clueless as to how to use soap or HTTP get/post to transfer the byte[] image to the web service.
Any help would be greatly appreciated.
Sayeed

if you want to use just an HTTP-POST, you can try the ASIHTTPRequest library. it wraps the NSHTTPRequest into an easy-to-use container.
there is also an example how to submit files (your png).

Related

Uploading images from iPad in base64 format and size limit

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.
hi just compress your image
NSData *imageData = UIImageJPEGRepresentation(theImage, 0.1f);
This compress your image and then convert it to base64..
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
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.

How to download a blob image from java server to iPhone app?

I have created a program which allows me to upload images to Java Server thru Multipart.
How can I receive an image from server and download it to iPhone app? Is there any way apart from NSURL i can download the image?
Base64 Encoding & Decoding seems to be not working.
If what you're downloading is base64 encoded, you can just download it using NSURLConnection. Once you have the data downloaded, base64 decode the data and put it into an NSData that can then be loaded into a UIImage. A solution for doing that can be found here on SO.
No matter what, though, you're going to need NSURL. ASIHTTPRequest provided a Core Foundation networking abstraction that is an alternative to NSURLConnection, however, it's bloated and it is no longer being maintained by the original author (though there are probably some forks that are being maintained).

How can I upload multiple images?

I would like to upload images along with a couple fields of data to a server from my app. How can I do that?
many web services do that like JSON Soap rest, you should learn to program a web service along with programming iOS.

Communication Of iPhone and Google App Engine

How can I get a pdf data (stored in datastore as blob) from iphone if i make a request to google app engine?
When I use
self.response.out.write('asadasd');
in google app engine code
I can see this 'asadasd' in iPhone.
But i don't know how to set this communication so that i can get a pdf data from i phone.
Thanks in advance!
If I understand corretly, you want to send an pdf file to a webapplication, right?
I think it would be a solution to base64 code the binary data of the pdf on the iphone (that comes from your blob) and then send it via http post to the webapplication.
You should set the proper headers before writing to the output stream:
self.response.headers['Content-Type'] = 'application/pdf'
self.response.headers['Content-Disposition'] = 'attachment;filename=filename.pdf'
self.response.out.write(...)

how to get data from web server to iphone or ipod

I'm quite new in iPhone development and I need to develop an app.
I must get mp3 data from a web server, which provides a simple saving the mp3 in my app document or folder
and use it in an application, which should also dislpay a table with rows like:
song1
song2
song3
But at present I don't know at all how to get this web page, parse it and store into an array in the application.
Please do you have any suggestion / hint / sample code ?
Thank you in advance,
There is a tutorial on the apple developer site on how to make a http request and receive data here. Should get you going on how to fetch the web page.
For parsing you can use the NSScanner or a XML/HTML parser library like TouchXML depending on your needs.
I used web services to communicate with web server, the following tutorial helped me a lot.
http://icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/
I was able to send and retrieve binary content using web service but I had to encode it first to be able to send it through Soap request and decode back Soap Response.
Hope that can help you,