title: Uploading file with parameters using Alamofire
body: <p>I am attempting to upload a file using <code>Alamofire</code>. The upload works fine when using a File (<code>NSUrl</code>), however, I cant seem to figure out how to use the <code>NSData</code> option?</p>
  
  <p>This is what I have as a test:</p>
  
  <pre><code> var url:NSURL = NSURL.URLWithString("http://localhost:8080/bike.jpeg")
  
   var err: NSError?
   var imageData :NSData = NSData.dataWithContentsOfURL(url,options: NSDataReadingOptions.DataReadingMappedIfSafe, error: &amp;err)
  
   Alamofire.upload(.POST, "http://localhost:8080/rest/service/upload/test.png", imageData)
          .progress { (bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) in
              println(totalBytesWritten)
          }
          .responseJSON { (request, response, JSON, error) in
              println(request)
              println(response)
             println(JSON)
   }
  </code></pre>
  
  <p>I am getting a status code 415?</p>
  
  <p>Also, how can I send across additional params in the upload?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I wasn't setting the correct Content-Type:</p>
  
  <pre><code>var manager = Manager.sharedInstance
  manager.session.configuration.HTTPAdditionalHeaders = ["Content-Type": "application/octet-stream"]
  
  
  let imageData: NSMutableData = NSMutableData.dataWithData(UIImageJPEGRepresentation(imageTest.image, 30));
  
  Alamofire.upload(.POST, "http://localhost:8080/rest/service/upload?attachmentName=file.jpg",  imageData)
          .progress { (bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) in
              println(totalBytesWritten)
          }
          .responseString { (request, response, JSON, error) in
              println(request)
              println(response)
              println(JSON)
  }
  </code></pre>
  
  <p>Still cant figure out how to send additional parameters along with the upload.</p>