title: How do I upload a file with metadata using a REST web service?
body: <p>I have a REST web service that currently exposes this URL:</p>
  
  <p><a href="http://server/data/media" rel="noreferrer">http://server/data/media</a></p>
  
  <p>where users can <code>POST</code> the following JSON:</p>
  
  <pre><code>{
      "Name": "Test",
      "Latitude": 12.59817,
      "Longitude": 52.12873
  }
  </code></pre>
  
  <p>in order to create a new Media metadata.</p>
  
  <p>Now I need the ability to upload a file at the same time as the media metadata. What's the best way of going about this? I could introduce a new property called <code>file</code> and base64 encode the file, but I was wondering if there was a better way.</p>
  
  <p>There's also using <code>multipart/form-data</code> like what a HTML form would send over, but I'm using a REST web service and I want to stick to using JSON if at all possible.</p>