I want to upload more than one image in single service request. How can I do that. As of now I am able to upload single image like as
NSData *imageData = UI
#define kStartTag @"--%@\r\n"
#define kEndTag @"\r\n"
#define kContent @"Content-Disposition: form-data; name=\"%@\"\r\n\r\n"
#define kBoundary @"---------------------------14737809831466499882746641449"
-(void)uploadImageonServers
{
NSMutableURLRequest *request = nil;
NSLog(@"image upload");
NSMutableData *body = [NSMutableData data];
request = [[NSMutableURLRequest alloc] init];
NSString *requestURL = [NSString stringWithFormat:@"http://192.168.1.101/gmento/index.php/api/professional/addServices"];
[request setURL:[NSURL URLWithString:requestURL]];
[request setHTTPMethod:@"POST"];
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",kBoundary];
[request addValue:contentType forHTTPHeaderField: @"Content-Type"];
// user ID parameter
[body appendData:[[NSString stringWithFormat:kStartTag, kBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:kContent, @"professional_id"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[@"1232" dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:kEndTag] dataUsingEncoding:NSUTF8StringEncoding]];
// Grop ID parameter
[body appendData:[[NSString stringWithFormat:kStartTag, kBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:kContent, @"title"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[@"test" dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:kEndTag] dataUsingEncoding:NSUTF8StringEncoding]];
// prepration_type_id parameter
[body appendData:[[NSString stringWithFormat:kStartTag, kBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:kContent, @"price"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[@"test" dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:kEndTag] dataUsingEncoding:NSUTF8StringEncoding]];
// description parameter
[body appendData:[[NSString stringWithFormat:kStartTag, kBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:kContent, @"description"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[@"test" dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:kEndTag] dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableArray *arr_images=[[NSMutableArray alloc] init];
[arr_images addObject:[UIImage imageNamed:@"1.jpg"]];
[arr_images addObject:[UIImage imageNamed:@"1.jpg"]];
for (int i=0; i