I am Using This Code
NSString *strrrr=@"";
UIImage *chooseImage=[infoDict valueForKey:@"filename"];
if (chooseImage)
{
strrrr=@"filename.JPG";
}
urlString=[NSString stringWithFormat:@"%@KabuterCompanyService?companyID=%@&companyTypeID=%@&serviceTypeID=%@&description=%@&serviceCreatedBy=%@&startDate=%@&endDate=%@&location=%@&promotionalText=%@&promotionalDocument=%@&colOfResponseOptionVO=%@&responseOptionQuestionVO=%@&componentName=%@&companyServiceID=%@&submit=%@&quickSend=%@&ajaxreq=%@&access_token=%@&commandResultAttributes : promotionalDocumentVO.mimeTypeVO.name,companyVO.companyName,serviceTypeVO.name,colOfOwnerEntitlementVO.entitlementID,colOfOwnerEntitlementVO.entitleableID,colOfSubscriberEntitlementVO.entitlementID,colOfSubscriberEntitlementVO.entitleableID,colOfResponseOptionVO.sequenceNumber,colOfResponseOptionVO.attributeValue,colOfResponseOptionVO.url,colOfResponseOptionVO.expiresOn,responseOptionQuestionVO.attributeValue,*",BaseURL2,[infoDict valueForKey:@"vendorID"],@"893688751",@"-2114174907",[infoDict valueForKey:@"EventName"],[infoDict valueForKey:@"HostName"],[infoDict valueForKey:@"StartDate"],[infoDict valueForKey:@"EndDate"],[infoDict valueForKey:@"Location"],[infoDict valueForKey:@"EventDescription"],strrrr,[infoDict valueForKey:@"colOfRequestParameterVO"],[infoDict valueForKey:@"responseOptionQuestionVO"],@"KabuterCompanyService",@"null",@"Create",@"true",@"json",[[NSUserDefaults standardUserDefaults] objectForKey:@"tokenID"]];
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlString]];
NSData *imageData = UIImageJPEGRepresentation(chooseImage, 1.0);
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:60];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"WebKitFormBoundaryjrFKfnmMBcXRMamI";
// set Content-Type in HTTP header
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
[request setValue:contentType forHTTPHeaderField: @"Content-Type"];
// post body
NSMutableData *body = [NSMutableData data];
// add params (all params are strings)
[body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=%@\r\n\r\n", @"imageCaption"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:@"%@\r\n", @"Some Caption"] dataUsingEncoding:NSUTF8StringEncoding]];
// add image data
if (imageData) {
[body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=%@; name=filename.JPG\r\n", @"name"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[@"Content-Type: image/jpeg\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:imageData];
[body appendData:[[NSString stringWithFormat:@"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
}
[body appendData:[[NSString stringWithFormat:@"--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
// setting the body of the post to the reqeust
[request setHTTPBody:body];
// set the content-length
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[body length]];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue currentQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
if(data.length > 0)
{
//success
}
}];
Not upload my image in Server And when my android team doing same thing they are getting image in server using this Android plz help me
Please help if someone know about this thing why i am unable to get my image in server.