title: Build multipart/form-data POST request in Angular2 and validate Input type File
body: <p>I have an image (base64) that I need to send via a POST request (and wait for the response).  The POST request needs to be of <code>Content-Type:multipart/form-data</code>.
  The image needs to be of <code>Content-Type: image/jpg</code></p>
  
  <p>The POST request should look like:</p>
  
  <pre><code>POST https://www.url... HTTP/1.1
  Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
  User-Agent: Fiddler
  Host: www.host.com
  Content-Length: 199640
  
  ---------------------------acebdf13572468
  Content-Disposition: form-data; name="fieldNameHere"; filename="Nikon Digital SLR Camera D3100 14.2MP 2.jpg"
  Content-Type: image/jpeg
  </code></pre>
  
  <p>With the binary image data as the content body.</p>
  
  <p>I'm attempting to use the Http Post method of angular 2, but I'm not quite sure about how to generate the request.
  This is what I have:</p>
  
  <pre><code>let body = atob(imageData);
  let headers = new Headers({'Content-Type': 'multipart/form-data'});
  let options = new RequestOptions({headers: headers});
  
  this._http.post(url, body, options)
  .map(res=&gt;{
    //do stuff
  });
  </code></pre>
  
  <p>I can tell that I am missing part of it but I am not sure what I need to do to give the binary image data it's Content-Disposition &amp; Type etc.</p>