저는 비디오 업로드 기능이 필요한 응용 프로그램을 만들고 있습니다. 나는 이것에 대한 NSURLRequest를 사용하고 있으며 길이가 1 분 미만인 비디오에 대해서는 정상적으로 작동하지만 비디오가 클 때 문제가 발생합니다. 아무도 그것에 대해 어떤 생각을 가지고 있습니까 ???1 분 이상 비디오를 업로드 할 수 없습니다.
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:urlString]];
[request setCachePolicy:NSURLRequestUseProtocolCachePolicy];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"----F00";
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
[request addValue:contentType forHTTPHeaderField:@"Content-Type"];
fileData = [NSData dataWithContentsOfURL:[mediaDict objectForKey:UIImagePickerControllerMediaURL]];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"data[file_name]\"; filename=\"%@\"\r\n", filename] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat: @"Content-Type: %@\r\n\r\n",fileContentType] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:fileData];
[request setHTTPBody:body];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:request delegate:self];
if (theConnection) {
// Create the NSMutableData to hold the received data.
// receivedData is an instance variable declared elsewhere.
self.receivedData = [NSMutableData data];
} else {
// Inform the user that the connection failed.
UIAlertView *didFailWithErrorMessage = [[UIAlertView alloc] initWithTitle: @"NSURLConnection " message: @"didFailWithError" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[didFailWithErrorMessage show];
[spinnerView removeFromSuperview];
}
정말 고맙습니다.
을 확인? –
안녕하세요. UIImagePicker를 사용하여 비디오를 캡처하고 비디오 길이가 1 분 이상이면 비디오가 서버에 업로드되지 않습니다. 위의 스 니펫은 1 분 미만의 동영상에 대해서는 정상적으로 작동합니다. 내 하찮은 영어 실력에 죄송하다는 말씀을 드리고 싶습니다. 당신이 내가 설명하고 싶은 것을 이해하기를 바랍니다. –
비디오를 어디로 업로드하고 있습니까? 수신 측의 제한 사항은 무엇입니까? –