Created
February 20, 2014 21:49
-
-
Save jameshadley/9123974 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; | |
AFHTTPSessionManager *_afHTTPSessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration]; | |
// set your response content type here | |
NSMutableSet *contentTypes = [[NSMutableSet alloc] init]; | |
[contentTypes addObject:@"application/json"]; | |
_afHTTPSessionManager.responseSerializer.acceptableContentTypes = contentTypes; | |
[_afHTTPSessionManager.requestSerializer setAuthorizationHeaderFieldWithUsername:username password:password]; | |
[_afHTTPSessionManager POST:postUrl parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { | |
[formData appendPartWithFileData:videoData name:@"uploadedFile" fileName:@"video.mp4" mimeType:@"video/mp4"]; | |
} success:^(NSURLSessionDataTask *task, id responseObject) { | |
NSLog(@"video operation success! %@", responseObject); | |
} failure:^(NSURLSessionDataTask *task, NSError *error) { | |
NSLog(@"Operation Error: %@", error); | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment