title: send image along with other parameters with AFNetworking
body: <p>I am updating an old application code which used <code>ASIHTTPRequest</code> with <code>AFNetworking</code>. In my case, I am sending a bench of data to <code>API</code>, these data are different types: Image and other.</p>
  
  <p>Here is the code I adopt so far, implementing an API client, requesting a shared instance, prepare the params dictionary and send it to remote API:</p>
  
  <pre><code>NSMutableDictionary *params = [NSMutableDictionary dictionary];
  [params setValue:@"Some value" forKey:aKey];
  
  [[APIClient sharedInstance]
   postPath:@"/post"
   parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
       //some logic
  
  
   } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
       //handle error
  
   }];
  </code></pre>
  
  <p>What would be the case when I want to add an image to the <code>params</code> dictionary? </p>
  
  <p>With <code>ASIHTTPRequest</code>, I used to do the following:</p>
  
  <pre><code>NSData *imgData = UIImagePNGRepresentation(anImage);
  
  NSString *newStr = [anImageName stringByReplacingOccurrencesOfString:@"/"
                                                                withString:@"_"];
  
  
  
  [request addData:imgData
      withFileName:[NSString stringWithFormat:@"%@.png",newStr]
    andContentType:@"image/png"
            forKey:anOtherKey];
  </code></pre>
  
  <p>I digged into <code>AFNetworking</code> documentation and found they appending the image in an <code>NSMutableRequest</code> like this:</p>
  
  <pre><code>AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
  NSData *imageData = UIImageJPEGRepresentation([UIImage imageNamed:@"avatar.jpg"], 0.5);
  NSMutableURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:@"/upload" parameters:nil constructingBodyWithBlock: ^(id &lt;AFMultipartFormData&gt;formData) {
      [formData appendPartWithFileData:imageData name:@"avatar" fileName:@"avatar.jpg" mimeType:@"image/jpeg"];
  }];
  </code></pre>
  
  <p>How should I mix this together on a neat way to integrate my image data into the <code>APIClient</code> request? Thanx in advance.</p>