title: PHP and Ajax file upload - Can't get the tmp_name with $_FILES
body: <p>I'm trying to upload a file using Ajax, but I'm having troubles handling the file...
  For test purposes I've build a simple code that looks like this:</p>
  
  <p>JS:</p>
  
  <pre><code>xmlhttp=new XMLHttpRequest();
  xmlhttp.open("POST",document.getElementById('upload').action,true);
  xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  var cmdStr="q="+str;
  xmlhttp.send(cmdStr);
  
  document.getElementById("ResponseDiv").innerHTML=xmlhttp.responseText;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>$q=$_POST["q"];
  echo $q;
  </code></pre>
  
  <p>It works fine and <code>xmlhttp.responseText</code> prints <code>[object File]</code>.</p>
  
  <p>My problem, however, is that I need to get the temporary file name with <code>$_FILES["q"]['tmp_name']</code>. To do so I have changed the code to the following:</p>
  
  <p>JS:</p>
  
  <pre><code>xmlhttp=new XMLHttpRequest();
  xmlhttp.open("POST",document.getElementById('upload').action,true);
  xmlhttp.setRequestHeader("enctype","multipart/form-data");
  var cmdStr="q="+str;
  xmlhttp.send(cmdStr);
  
  document.getElementById("ResponseDiv").innerHTML=xmlhttp.responseText;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>$q=$_FILES["q"]["tmp_name"];
  echo $q;
  </code></pre>
  
  <p>Problem is that now with <code>xmlhttp.responseText</code> I don't get anything.
  Anyone knows what I'm doing wrong?</p>