title: Upload an image with AFNetworking 2.0
body: <p>I can't understand why this is so hard. All the tutorials and articles online seem to be talking about the 1.0 api, which is pretty useless.</p>
  
  <p>I've tried a few different ways and get different results. What am I doing wrong?</p>
  
  <ol>
  <li><p>upload task - this seems to not be using a multipart form, wtf?</p>
  
  <pre><code>NSMutableURLRequest *request = [self.manager.requestSerializer multipartFormRequestWithMethod:@"POST"
                                                                                    URLString:[[NSURL URLWithString:url relativeToURL:[NSURL URLWithString:ApiBaseUrl]] absoluteString]
                                                                                   parameters:@{}
                                                                    constructingBodyWithBlock:nil];
  
  NSProgress *progress;
  NSURLSessionUploadTask *task = [self.manager uploadTaskWithRequest:request
                                                          fromData:data
                                                          progress:&amp;progress
                                                 completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
                                                   if (error) {
                                                     NSLog(@"[error description] = %@", [error description]);
                                                   } else {
                                                     NSLog(@"success!");
                                                   }
                                                 }];
  
  [task resume];
  </code></pre></li>
  <li><p>post with a block - this seems not to attach anything</p>
  
  <pre><code>[self.manager POST:url
             parameters:@{}
  constructingBodyWithBlock:^(id &lt;AFMultipartFormData&gt; formData) {
      [formData appendPartWithFileData:data
                                  name:@"post[picture]"
                              fileName:@"picture.jpg"
                              mimeType:@"image/jpeg"];
  }
                success:^(NSURLSessionDataTask *task, id response) {
                  NSLog(@"Success");
                }
                failure:^(NSURLSessionDataTask *task, NSError *error) {
                  NSLog(@"Error: %@", error);
                }];
  </code></pre></li>
  <li><p>simple post - this seems to almost work...but not</p>
  
  <pre><code>[self.manager POST:url
          parameters:@{@"post[picture][]":data}
             success:^(NSURLSessionDataTask *task, id response) {
               NSLog(@"Success");
             }
             failure:^(NSURLSessionDataTask *task, NSError *error) {
               NSLog(@"Error: %@", error);
             }];
  </code></pre></li>
  </ol>
  
  <p></p>
  
  <p>I would love 1 to work, but I'm not sure why it doesn't.</p>