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!
If you want to upload multiple images then this demo is good option.
Looks like Three20 library has support for POSTing images to HTTP server.
See TTURLRequest.m
And it's released under Apache 2.0 License.
Create an NSURLRequest and then use NSURLConnection to send it off to your server.
Header:
Main:
Usage:
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...