从ios上传视频到服务器然后给我502错误的网关错误

时间:2013-08-02 05:33:38

标签: ios asihttprequest

我正在尝试将视频从我的ios设备上传到服务器。

当我上传然后给我502坏网关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错误?

感谢。

1 个答案:

答案 0 :(得分:0)

我的视频上传代码是正确的,服务器端的问题......

我尝试使用php上传并成功上传视频。