Please check my code:
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];
My need is :
Convert UIImage to Base64 String - Its completed
Post this values to server. But server always displays null value. Instead of post base64 string to any other string Its worked correctly.
[requestmethod setPostValue:[NSString stringWithFormat:@"%@",encodedString] forKey:@"imgpath"];