Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload bulk image in background thread

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.

like image 591
Nitin Avatar asked Jun 28 '26 13:06

Nitin


1 Answers

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

like image 149
Nimit Parekh Avatar answered Jun 30 '26 03:06

Nimit Parekh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!