title: Ajax PHP file upload mistake
body: <p>I have this code in client side: </p>
  
  <pre><code>fileUpload: function monkey(){
          var file = t.gI("photoFile"); //get element by photoFile
          var formData = new FormData();
          console.log(file.files.length);
          formData.append("upload", file.files[0]);
          var req = t.gR(); //XMLHTTPRequest
          req.open('POST', 'php/fileupload.php', true);
          req.setRequestHeader("Content-Type", "multipart/form-data", true);
          req.send(formData);
          req.onreadystatechange = function () {
              if (req.readyState === 4) {
                  if (req.status == 200 &amp;&amp; req.status &lt; 300) {
                      t.gI("eventBox").innerHTML = req.responseText; //eventbox error handler
                      adminHandler.eventBox();
                  }
              }
          }
      },
  </code></pre>
  
  <p>And this in server side:</p>
  
  <pre><code>&lt;?php
      header('Content-Type:multipart/form-data');
  
      echo $_FILES['upload']['tmp_name'];
  ?&gt;
  </code></pre>
  
  <p>And I got this error msg: </p>
  
  <p>[15-Jun-2015 12:03:21 UTC] PHP Warning:  Missing boundary in multipart/form-data POST data in Unknown on line 0
  [15-Jun-2015 12:03:21 UTC] PHP Notice:  Undefined index: upload in /home/webprogb/public_html/php/fileupload.php on line 4</p>
  
  <p>What can I do to fix it? </p>