Download bulk image in background stream

I want to know how we can upload many images using webservice to an iPhone with a background thread or process. I store most of the images in my iPhone application and I want to upload (publish) these images using the .net web service. Right now, I am positioning one image using a web service, but want to post multiple images in the background. Please help me, I will be grateful for that.

+3
source share
1 answer

I think you need to use the ASIHTTP request, which is used to asynchronously call the server, and several images are stored on the server.

.

- (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];
    }
}

ASIHttp As Asynchronous

URL

+2

All Articles