1

I have an error on the server while uploading a video using NSURLSessionUploadTask, the server error states:

PHP Warning: Missing boundary in multipart/form-data POST data in Unknown on line 0

and here is my code:

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];

    NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];

    NSString *finalURLFormat = [NSString stringWithFormat:@"%@%@", kAPIUrl, url];
    NSMutableURLRequest *request = [self setHeadersForURL:finalURLFormat Method:@"POST"];

    [request setHTTPMethod:@"POST"];



    NSURLSessionUploadTask *postDataTask = [session uploadTaskWithRequest:request fromFile:data completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        NSError *jsonError;

        NSDictionary *jsonResponse =
        [NSJSONSerialization JSONObjectWithData:data
                                        options:NSJSONReadingAllowFragments
                                          error:&jsonError];

        if (!jsonError) {
            NSHTTPURLResponse *httpResp = (NSHTTPURLResponse*) response;

            if (httpResp.statusCode < 400) {


            }
            else {


            }
        }

    }];

    [postDataTask resume];
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Laur Stefan
  • 1,519
  • 5
  • 23
  • 50

0 Answers0