Skip to content

Instantly share code, notes, and snippets.

@corinnekrych
Created January 9, 2014 10:32
Show Gist options
  • Save corinnekrych/8332229 to your computer and use it in GitHub Desktop.
Save corinnekrych/8332229 to your computer and use it in GitHub Desktop.
NSData *imageData = UIImageJPEGRepresentation(self.imageView.image, 0.2);
AGFileDataPart *dataPart2 = [[AGFileDataPart alloc] initWithFileData:imageData
name:@"image"
fileName:@"image.jpeg" mimeType:@"image/jpeg"];
AGFileDataPart *dataPart1 = [[AGFileDataPart alloc] initWithFileData:[NSKeyedArchiver archivedDataWithRootObject:@{@"title":@"ttt"}] name:@"image" fileName:@"image.jpeg" mimeType:@"image/jpeg"];
// set up payload
NSDictionary *dict = @{@"data1:": dataPart1, @"data2:": dataPart2, @"uploadType":@"multipart"};
[pipe save:dict success:^(id responseObject) {
NSLog(@"Successfully uploaded!");
} failure:^(NSError *error) {
NSLog(@"An error has occured during upload! \n%@", error);
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment