I want to know that how can we upload many number of images using webservice in iPhone with background thread or process. I am storing bulk of images in my iPhone app and i want to upload(post) those images using .net web-service. Right now, i am positing single image using web service but i want to post multiple images in background process. Please help me i will appreciate for it.
i think you need to use ASIHTTP request which use to Asynchronous call to server and multiple images stores on to the server.
For that implementation of that method after this method use to upload the images.
- (IBAction)btnPostImages_Clicked:(id)sender {
if ([arrImages count] > 0) {
NSString *strURL = @"Write Your URL Here.";
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:strURL]];
[request setDelegate:self];
[request setPostValue:@"This is sample text..." forKey:@"text"];
for (int i = 0; i < [arrImages count]; i++) {
[request addData:[arrImages objectAtIndex:i] withFileName:@"image.jpg" andContentType:@"image/jpeg" forKey:[NSString stringWithFormat:@"image%d", i + 1]];
}
[request startAsynchronous];
}
else {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Message" message:@"Please select images..." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
}
Also you can follow this tutorial for implementation of the ASIHttp As Asynchronous
Reference Url Here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With