Reputation: 469
i am working on an app based on job portal, now i am stuck with document upload, i need to look for documents on device on button click, and attach document on selection.I have to upload selected document to server. how can i do this ? any way out ?
Upvotes: 0
Views: 734
Reputation: 469
I found solution for my query.Below is the code.
- (IBAction)search:(id)sender {
UIDocumentMenuViewController *importMenu =
[[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[@"public.data"]
inMode:UIDocumentPickerModeImport];
importMenu.delegate = self;
[self presentViewController:importMenu animated:YES completion:nil];
[importMenu addOptionWithTitle:@"Photos" image:nil order:UIDocumentMenuOrderFirst handler:^{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
[self presentViewController:imagePickerController animated:YES completion:nil];
}];
}
-(void)documentMenu:(UIDocumentMenuViewController *)documentMenu didPickDocumentPicker:(UIDocumentPickerViewController *)documentPicker
{
documentPicker.delegate = self;
[self presentViewController:documentPicker animated:YES completion:nil];
}
Upvotes: 1