title: POST a file as a binary stream to server using javascript
body: <p>I have a doubt, I have tried searching on the web generally, but I do not find the answer i want.
  from the local system, I have uploaded a file using html input type=file attribute.
  now i would like to make this file as a binary stream using javascript and then do a POST of this stream to the server.
  Does anyone have an idea or an example code for me to understand how it works?</p>
  
  <p>For ex:
  i have</p>
  
  <pre><code>&lt;input type="file" id="myFile"&gt;
  &lt;button onclick="myFunction()"&gt;Upload&lt;/button&gt;
  &lt;script&gt;
  function myFunction() 
  
      {
      var x = document.getElementById("myFile"); 
      //convert x to a IOstream*
      //do a HTTP POST request to server and also write the file as stream like request.getstream
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Is this possible with only JS? At the moment I am only focusing on uplaoding media files like images.
  it has to be uploaded as a IOstream because that is the only format accepted by server.
  Also, it has to work with Safari!!
  Thanks in advance!</p>