Created
January 8, 2015 08:08
-
-
Save xyhp915/e9e8569ae4cac5951891 to your computer and use it in GitHub Desktop.
IOS AF Upload
This file contains hidden or 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
| //AF Upload | |
| UIImage *image = [UIImage imageNamed:@"1.png"]; | |
| NSData *dataImage = UIImageJPEGRepresentation(image, 1.0); | |
| AFHTTPRequestOperationManager *manage = [AFHTTPRequestOperationManager manager]; | |
| [manage POST:User_Image parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { | |
| [formData appendPartWithFileData:dataImage name:@"file" fileName:@"1.png"mimeType:@"image/jpeg"]; | |
| } success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
| NSString *str = [responseObject objectForKey:@"msg"]; | |
| NSLog(@"%@",str); | |
| } failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
| NSLog(@"%@",error); | |
| }]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment