Sending more then one image with AFNetworking
===

I'm developing a messaging app, and users can also send pictures to one another.     
When user sends more then one picture I send them in parallel (I don't wait for the first one to finish upload before I send the second one)    

Before moving to `AFNetworking` I succeed doing this with `ASIFormDataRequest`, and indeed if I sent 2 images, both of them were transmitted in parallel and successfully delivered to the other user.  

When I try doing this with AFNetworking, I got some strange behavior,   
I'll try to describe the case were user1 send two images too user2:    


1. User1 send image1 -> everything looks ok, I can see the upload progress.  
2. User1 then send image2 -> still looks ok, I can see the upload progress of both images  
3. image1 upload is finished -> user2 gets a corrupted image that looks like a combination of image1 and image2 together!  
4. image2 upload is finished -> user2 gets image2 successfully  


This is how I send an image  


    - (void)sendImageMsgWithPath:(NSString *)path
                           image:(UIImage *)image
                         success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                         failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
                        progress:(void (^)(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress
    {
        NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
    
        // create the request
        
        NSURLRequest *request = [[AppClient sharedClient] multipartFormRequestWithMethod:@"POST" path:path parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) 
                                 {
                                     [formData appendPartWithFileData:imageData name:@"image_name" fileName:@"image_name.jpg" mimeType:@"image/jpeg"];
                                 }];
        
        
        // create the operation
        
        AFHTTPRequestOperation *operation = [[[AFHTTPRequestOperation alloc] initWithRequest:request] autorelease];
        
        // set progress block
        
        [operation setUploadProgressBlock:progress];
        
        //set completion blocks
        
        [operation setCompletionBlockWithSuccess:success failure:failure];
        
        // set it to work in background
        
        [operation setShouldExecuteAsBackgroundTaskWithExpirationHandler:nil];
        
        // add it to the operations queue
        
        [[AppClient sharedClient] enqueueHTTPRequestOperation:operation];
    }

  
*** the path for both image uploads is the same:     

> path =
> @"FrontEnd?cmd=sendimage&fromuserid=3&touserid=1&"  
  
it will be added to the baseURL to create the coplete URL:  
> @"http://somename.myftp.org:8080/web_proj/FrontEnd?cmd=sendimage&fromuserid=3&touserid=1"

      
This are the images I sent:  
image1  
![enter image description here][1]  

image2  
![enter image description here][2]  

corrupted image  
![enter image description here][3]


  [1]: http://i.stack.imgur.com/C56S5.png
  [2]: http://i.stack.imgur.com/Nzd8H.png
  [3]: http://i.stack.imgur.com/FvSnw.png