2011-03-09 36 views
0

我正在iPhone上開發應用程序。這個應用程序也有自己的網站。 iPhone應用程序需要將視頻從iPhone上傳到網站。我不知道如何 來做這個任務。請給我一個編碼或任何指導來做到這一點。將視頻上傳到iPhone應用程序的網站

在此先感謝

回答

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]); 
相關問題