1

我正在尝试使用UIImagePickerController. 请建议我如何做或为此提供样本。

4

1 回答 1

0

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

{

NSURL *urlvideo = [info objectForKey:UIImagePickerControllerMediaURL];


//urlvideo contains the URL of that video file that has to be uploaded. Then convert the url into NSString type because setFile method requires NSString as a parameter

NSString *urlString=[urlvideo path];

NSLog(@"urlString=%@",urlString);
NSString *str = [NSString stringWithFormat:@"path of server"];

NSURL *url = [NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];

[request setFile:urlString forKey:@"key foruploadingFile"];

[request setRequestMethod:@"POST"];

[request setDelegate:self];

[request startSynchronous];

NSLog(@"responseStatusCode %i",[request responseStatusCode]);

NSLog(@"responseStatusCode %@",[request responseString]);

}
于 2012-10-11T12:17:15.317 回答