سؤال

i am trying to upload video from my ios device to server.

while i upload then given me 502 bad gateway nginx/1.2.1 error.

server side i don't know anything.

below is my upload code

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];

how can solve it? and what is 502 error?

thanks.

هل كانت مفيدة؟

المحلول

my video upload code is correct ,the problem in server side...

i try to upload using php and upload video successfully.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top