Uploading Video with iPhone

后端 未结 4 1208
甜味超标
甜味超标 2020-11-27 12:08

Is it possible to upload video to a server? I know that images are possible. If someone can just point me in the right direction that would be awesome.

Thanks

4条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 12:13

    NSURL *urlvideo = [info objectForKey:UIImagePickerControllerMediaURL];
    
     NSString *urlString=[urlvideo path];
    
    NSLog(@"urlString=%@",urlString);
    
    NSString *str = [NSString stringWithFormat:@"you url 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]);
    

提交回复
热议问题