请检查我的代码:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://portal.ebs-next.com/ebsrentalinspectiontest/servicelayer/ebsrentalcheckinservicelayer.asmx/SetRentalCheckInImages",baseUrl]];
//////NSLog(@"URL:%@",url);
__block ASIFormDataRequest *requestmethod = [ASIFormDataRequest requestWithURL:url];
NSUserDefaults *loginCheck=[NSUserDefaults standardUserDefaults];
NSString *loginValidation=[loginCheck valueForKey:@"USER_ID"];
UIImage *img = [UIImage imageNamed:@"overlaygraphic.png"];
NSData *imageData = UIImageJPEGRepresentation(img, 1.0);
NSString *encodedString = [imageData base64Encoding];
[requestmethod setValidatesSecureCertificate:NO];
[requestmethod setPostValue:@"196" forKey:@"checkindetlid"];
[requestmethod setPostValue:encodedString forKey:@"imgpath"];
[requestmethod setPostValue:@"" forKey:@"description"];
[requestmethod setPostValue:@"0" forKey:@"id"];
[requestmethod setPostValue:@"" forKey:@"content"];
[requestmethod setPostValue:@"0" forKey:@"offset"];
[requestmethod setPostValue:@"mRHcXXatqUayMNyP8nlEmA==" forKey:@"usrToken"];
[requestmethod setPostValue:@"KLB050572RC" forKey:@"equipmentid"];
//[requestmethod setPostFormat:ASIMultipartFormDataPostFormat];
[requestmethod setTimeOutSeconds:500];
[requestmethod setCompletionBlock:^{
NSString *responseString23 = [requestmethod responseString];
NSLog(@"Image Response:%@",responseString23);
}];
[requestmethod setFailedBlock:^{
NSError *error = [requestmethod error];
NSLog(@"%@",error.localizedDescription);
}];
[requestmethod startAsynchronous];
我的需求是:
将UIImage转换为Base64字符串 - 已完成
将此值发布到服务器。但服务器始终显示空值。而不是将base64字符串发布到任何其他字符串它的工作正常。
[requestmethod setPostValue:[NSString stringWithFormat:@"%@",encodedString] forKey:@"imgpath"];