Skip to content

Instantly share code, notes, and snippets.

@catalinaturlea
Created February 19, 2016 12:08
Show Gist options
  • Select an option

  • Save catalinaturlea/c14565643fb814c0904e to your computer and use it in GitHub Desktop.

Select an option

Save catalinaturlea/c14565643fb814c0904e to your computer and use it in GitHub Desktop.
upload example from Objective-c
[AlamofireWrapper upload:RequestMethodPOST :@"http://myaddress.com" headers:nil multipartFormData:^NSArray<BodyPart *> * _Nonnull {
return @[[[BodyPart alloc] initWithData:[NSData dataWithContentsOfFile:@"myVeryLargeFile.jpg"] name:@"picture"]];
} success:^(NSURLRequest * _Nullable request, NSHTTPURLResponse * _Nullable response, NSDictionary * _Nullable json) {
NSLog(@"Success");
} failure:^(NSURLRequest * _Nullable request, NSHTTPURLResponse * _Nullable response, NSError * _Nullable error) {
NSLog(@"Failure");
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment