title: PHP AJAX file upload
body: <p>i've looked all over stackoverflow and the general internet and i can't find a simple AJAX file uploader (Just form submission). The ones i have found aren't flexible enough and don't fit my purpose. If i could ajust this script to file uploads, that would be great:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   function upload(str)
   {
   if (str.length==0)
   { 
  document.getElementById("txtHint").innerHTML="";
   return;
    }
   if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
     xmlhttp=new XMLHttpRequest();
     }
   else
     {// code for IE6, IE5
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
   xmlhttp.onreadystatechange=function()
     {
     if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
       {
       document.getElementById("hint").innerHTML=xmlhttp.responseText;
       }
     }
   xmlhttp.open("GET","ajax/link.php?q="+str,true);
   xmlhttp.send();
   }
  </code></pre>
  
  <p></p>
  
  <p>In the HTML i would have </p>
  
  <pre><code>&lt;input type='file' onblur='upload(this.value)'&gt;
  </code></pre>
  
  <p>Thanks</p>