vendredi 27 juin 2014

Send Two Images to web server


Vote count:

0




I've successfully one image to web server. Now I need to modify the code to send two images with Two different urls . The code i've used to send singe image is



NSString *url=[NSString stringWithFormat:@"http://ift.tt/1m3nzz3",requestString];
NSLog(@"url1%@",url);
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ;
[request setURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"POST"];

// Create 'POST' MutableRequest with Data and Other Image Attachment.

NSString *boundary = @"---------------------------14737809831466499882746641449";
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
[request setValue:contentType forHTTPHeaderField:@"Content-Type"];

NSData *data = UIImageJPEGRepresentation(chosenImage1, 0.2f);
[request addValue:@"image/JPEG" forHTTPHeaderField:@"Content-Type"];
NSMutableData *body = [NSMutableData data];
[body appendData:[NSData dataWithData:data]];
[request setHTTPBody:body];


Help me, Thanks in advance for everyone.



asked 14 secs ago






Aucun commentaire:

Enregistrer un commentaire