-
-
Save ClaudeSutterlin/8e9566f6a48d965b962d 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
NSURL *url = <your url>; | |
NSURL *fileUrl = <url to file on the local system> | |
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
[manager.requestSerializer setValue: self.accessToken forHTTPHeaderField:@"AccessToken"]; | |
[manager POST: url.absoluteString parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { | |
NSError *error; | |
[formData appendPartWithFileURL: fileUrl name:@"upload" error: &error]; | |
NSLog(@"Error: %@", error); | |
} success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSLog(@"Success: %@", responseObject); | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
NSLog(@"Error: %@", error); | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment