Reputation: 310
I use the delegate of UIImagePickerController for choosing a photo and put it to the server but the problem is i don't know how can i do that using ASIFormDataRequest and i don't know what key should use for the info parameter?
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *str = [NSString stringWithFormat:@"http://www.siteweb.com/api/v2/businesses/%@/pics.xml",entry.permalink];
NSURL *url = [NSURL URLWithString:str];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
request.delegate = self;
[request startAsynchronous];
[self dismissModalViewControllerAnimated:YES];
}
Upvotes: 0
Views: 191
Reputation: 16714
Like this:
[request addFile:(NSString *)filePath forKey:(NSString *)key];
Get the image like this beforehand:
UIImage *image = (UIImage *) [info valueForKey:UIImagePickerControllerOriginalImage];
[UIImageJPEGRepresentation(image, 1.0) writeToFile:filePath atomically:YES];
Upvotes: 1