title: Javascript XHR send multipart/form-data
body: <p>I'm trying to send a multipart/form-data content-type request:</p>
  
  <pre><code>var xhr = new XMLHttpRequest();
  
  xhr.onreadystatechange = function(){
      if(xhr.readyState==4){
           alert(xhr.responseText);
      }
  }
  
  xhr.open("POST", url, true);
  xhr.setRequestHeader("Content-Type","multipart/form-data; boundary=---------------------------275932272513031");
  
  xhr.send('-----------------------------275932272513031 Content-Disposition: form-data; name="name"
  
  test
  
  ----------------------------275932272513031--');
  </code></pre>
  
  <p>Then in php I just print the <code>$_POST</code> array</p>
  
  <pre><code>print_r($_POST);
  </code></pre>
  
  <p>But I get an empty array each time. I expect to see </p>
  
  <pre><code>Array (
      name =&gt; "test"
  )
  </code></pre>
  
  <p>What am I doing wrong?</p>