Skip to content

Instantly share code, notes, and snippets.

Created October 23, 2015 02:40
Show Gist options
  • Save anonymous/fc93fac5ebed80d3fb73 to your computer and use it in GitHub Desktop.
Save anonymous/fc93fac5ebed80d3fb73 to your computer and use it in GitHub Desktop.
NSMutableURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:@"csv_files" parameters:nil constructingBodyWithBlock: ^(id <AFMultipartFormData>formData) {
[formData appendPartWithFileData:data name:[NSString stringWithFormat:@"KegCop-users-%@.csv",idfv] fileName:[NSString stringWithFormat:@"KegCop-users-%@.csv",idfv] mimeType:@"text/csv"];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
NSLog(@"Sent %lld of %lld bytes", totalBytesWritten, totalBytesExpectedToWrite);
}];
[httpClient enqueueHTTPRequestOperation:operation];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment