我在Iphone中编写了客户端代码。
self.postRequest = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:@"http://Services/UploadVideo.asmx"]];
NSString *urlString=[self.videoURL path];
NSLog(@"urlString=%@",urlString);
[self.postRequest setFile:urlString forKey:@"videoUrl"];
[self.postRequest setRequestMethod:@"POST"];
[self.postRequest setDelegate:self];
[self.postRequest setDidFailSelector:@selector(postFailed:)];
[self.postRequest setDidFinishSelector:@selector(postSuccessful:)];
[self.postRequest startAsynchronous];
LOG output:// urlString=/private/var/mobile/Applications/09108E9E-1494-4C25-8C3E-328B95BD1504/tmp/capture-T0x1e569fd0.tmp.w37766/capturedvideo.MOV
我应该如何捕获它并将其保存在服务器上? 提前谢谢..
答案 0 :(得分:1)
首先,您需要将视频转换为nsdata
NSData *data = [NSData dataWithContentsOfFile:video_url];
然后将nsdata转换为base64字符串(您需要为base64下载单独的文件)
NSString *encodedString=[data base64EncodedString];
所以最后你可以将编码的字符串发送到你的.net服务器(你需要解码.net服务器中的编码字符串来检索视频)
以上代码对我来说是图像转换(我认为它也适用于视频)