I'm writing an iPhone app that takes a photo and then uploads it to a server. How do I upload a photo to a server with Cocoa? I suppose I use NSUrl somewhere.
Thanks!
I'm writing an iPhone app that takes a photo and then uploads it to a server. How do I upload a photo to a server with Cocoa? I suppose I use NSUrl somewhere.
Thanks!
Hope following code snippet will work for you. I have used NSDateFormatter and NSDate to get unique name each time for the image.
Note:
'ImageUploadURL'
is the string #define with the base url, you need to replace it with your server url.//Date format for Image Name...
Looks like Three20 library has support for POSTing images to HTTP server.
See TTURLRequest.m
And it's released under Apache 2.0 License.
If you want to upload multiple images then this demo is good option.
Header:
Main:
Usage:
Create an NSURLRequest and then use NSURLConnection to send it off to your server.