title: RestKit Image Upload
body: <p>I am using RestKit to drive interactions with my web server. I am trying to use routing to POST an Event object to the server with an image attached to it. The code is as follows:</p>
  
  <pre><code>  RKObjectManager *manager = [RKObjectManager sharedManager];
  
    RKObjectMapping *map = [self eventMapping];
    manager.serializationMIMEType = RKMIMETypeFormURLEncoded;
    map.rootKeyPath = @"event";
    [manager.mappingProvider setSerializationMapping:map forClass:[Event class]];
    [manager.router routeClass:[Event class] toResourcePath:@"/v1/events.json" forMethod:RKRequestMethodPOST];
  
    [manager postObject:event delegate:self block:^(RKObjectLoader *loader){
      RKObjectMapping *serMap = [[[RKObjectManager sharedManager] mappingProvider] serializationMappingForClass:[Event class]];
      NSError *error = nil;
      NSDictionary *d = [[RKObjectSerializer serializerWithObject:event mapping:serMap] serializedObject:&amp;error];
  
      RKParams *p = [RKParams paramsWithDictionary:d];
      [p setData:[event imageData] MIMEType:@"image/jpeg" forParam:@"image"];
      loader.params = p;
    }];
  </code></pre>
  
  <p>If I create an instance of RKParams using the serialized Event object, then add the image data and assign it as the RKObjectLoader's params property, all the properties become one massive serialized string. There must be a way to upload an image without the massive string serialization.</p>
  
  <p>I have also tried having an NSData property that is mapped to some attribute, converting a UIImage into NSData along the way, but RestKit complains that it can't be mapped. Has anyone done this before?</p>