我正在尝试将视频从我的 ios 设备上传到服务器。
虽然我上传然后给了我 502 bad gateway nginx/1.2.1 错误。
服务器端我什么都不知道。
下面是我的上传代码
ASIFormDataRequest *request=[ASIFormDataRequest requestWithURL:url_album];
request.delegate=self;
NSHTTPCookie *cookies=[appDelegate.AuthCookies objectAtIndex:0];
[request setUseCookiePersistence:NO];
[request setRequestCookies:[NSMutableArray arrayWithObject:cookies]];
NSString *Title=[[NSString alloc] initWithFormat:@"%@.mov",videoName];
[request addRequestHeader:@"Content-Type"value:
@"multipart/form-data;boundary=---------------------------1842378953296356978857151853"];
[request addPostValue:Title forKey:@"title"];
[request setPostValue:Disc.text forKey:@"description"];
[request setPostValue:Visibility_Text forKey:@"visibility"];
[request setPostValue:@"1" forKey:@"thumbnailid"];
NSLog(@"filePath:%@",appDelegate.FilePath);
[request setFile:appDelegate.FilePath withFileName:Title andContentType:@"video/quicktime" forKey:@"file"];
[request setRequestMethod:@"POST"];
request.showAccurateProgress=YES;
[request setUploadProgressDelegate:PrograssView];
request.numberOfTimesToRetryOnTimeout = 3;
[request setTimeOutSeconds:15*60];
[request setCompletionBlock:^{
NSData *ResponseData=[request responseData];
if (ResponseData.length != 0)
{
//NSError* error;
//NSMutableDictionary* json = [NSJSONSerialization JSONObjectWithData:ResponseData options:kNilOptions error:&error];
NSLog(@"response:%@,%@",[request responseString],[request responseHeaders]);
HUD.hidden=YES;
PrograssView.hidden=YES;
PrograssBg.hidden=YES;
}
}];
[request setFailedBlock:^{
NSError *error = [request error];
NSLog(@"Error:%@",error);
HUD.hidden=YES;
}];
[request startAsynchronous];
怎么解决呢?什么是 502 错误?
谢谢。