title: JavaScript: Upload file
body: <p>Let's say I have this element on the page:</p>
  
  <pre><code>&lt;input id="image-file" type="file" /&gt;
  </code></pre>
  
  <p>This will create a button that allows the users of the web page to select a file via an OS "File open..." dialog in the browser.</p>
  
  <p>Let's say the user clicks said button, selects a file in the dialog, then clicks the "Ok" button to close the dialog.</p>
  
  <p>The selected file name is now stored in:</p>
  
  <pre><code>document.getElementById("image-file").value
  </code></pre>
  
  <p>Now, let's say that the server handles multi-part POSTs at the URL "/upload/image".</p>
  
  <p>How do I send the file to "/upload/image"?</p>
  
  <p>Also, how do I listen for notification that the file is finished uploading?</p>