I am trying to implement a photo upload system via a webview.
I have it working via the safari browser, but have yet to get it working via the webview. My research has led me to realise I need to use UIImagePickerController in order to capture the image file path, and have this method:
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *path = [[NSBundle mainBundle] bundlePath];
NSData *data = UIImageJPEGRepresentation( [info objectForKey:@"UIImagePickerControllerOriginalImage"] , 1.0);
NSString *fullPath = [path stringByAppendingPathComponent:@"image_tmp.jpg"];
if ([[NSFileManager defaultManager] createFileAtPath:fullPath contents:data attributes:nil] ) {
NSLog([NSString stringWithFormat:@"file successfully written to path %@",fullPath],nil);
}
}
However, I am having trouble working out how I intercept and respond to the ajax call via the UIImagePickerController.