从iPhone应用程序上传视频到网站

时间:2011-03-09 08:07:56

标签: iphone video upload

我正在iPhone中开发一个应用程序。这个应用程序也有自己的网站。 iPhone应用程序需要将视频从iPhone上传到网站。我不知道怎么回事 做这个任务。请为我建议编码或任何指南。

提前致谢

1 个答案:

答案 0 :(得分:0)

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]);