Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Created September 1, 2010 01:09
Show Gist options
  • Save lukeredpath/560067 to your computer and use it in GitHub Desktop.
Save lukeredpath/560067 to your computer and use it in GitHub Desktop.
LRRestyRequestMultipartFormData *multipart = [[LRRestyRequestMultipartFormData alloc] init];
[multipart addPart:^(LRRestyRequestMultipartPart *part) {
part.name = @"upload";
part.fileName = @"My holiday.jpg"
part.contentType = @"image/jpeg";
part.data = UIImageJpegRepresentation(myImage);
}];
[multipart addPart:^(LRRestyRequestMultipartPart *part) {
part.name = @"comment";
part.contentType = @"text/plain";
part.data = [@"this is a comment" dataUsingEncoding:NSUTF8Encoding];
}];
[[LRResty client] post:@"http://www.example.com/endpoint" payload:multipart withBlock:^(LRRestyResponse *response) {
if (response.status == 201) {
NSLog(@"It worked!");
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment