title: XMLHttpRequest to upload a file with parameters
body: <p>I want to upload a file using XMLHTTRequest for Safari 5.1 and pass parameters in the POST request.How can this be achieved?It should be in plain javascript without using any API and I am doing this as Safari does not support FileReader in 5.1 version.</p>
  
  <pre><code>var fd = new FormData();
  fd.append('file', $files[i]);
  var xhr = new XMLHttpRequest();
  xhr.addEventListener("load", function(){alert("Done!");}, false);
  xhr.open("POST", url.getUrl('myurl'));
  xhr.send(fd);
  </code></pre>
  
  <p>Is the above piece of code correct?How do I pass parameters to the POST request.</p>