一般我们都会base64上传图片,代码如下:
- (void)uploadPhotoToSrver:(UIImage *) image withPhotoID:(NSString *)photoID andPhotoType:(PhotoType)type andImageText:(NSString *)text {
static int upLoadCount = 0;
NSData *imageData = UIImageJPEGRepresentation(scaledImg, 0.6);
NSString *dataStr = [imageData base64EncodedStringWithOptions:0];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/xml"];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
//参数
NSDictionary *parameters = @{@"UserID" : userInfo.UserID, @"imageDataStr": dataStr};
// url String
NSString *baseURL = [NSString stringWithF