How do I do an HTML5 file upload?
<p>For some strange reason the following code doesn't print out anything when I upload a file. I thought the HTML5 / jQuery would return something, but I'm not getting anything back when I print out my variables.</p>

<pre><code>&lt;? print_r($_FILES) ?&gt;
&lt;? print_r($_POST) ?&gt;
&lt;? print_r($_GET) ?&gt;
&lt;? print_r($_REQUEST) ?&gt;
&lt;form enctype="multipart/form-data" action="/upload.php" 
method="post" class="putImages"&gt;
   &lt;input name="media[]" type="file" multiple/&gt;
   &lt;input class="button" type="submit" alt="Upload" value="Upload" /&gt;
&lt;/form&gt;

&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
$(function() {
var data = new FormData($('input[name^="media"]'));     
jQuery.each($('input[name^="media"]')[0].files, function(i, file) {
    data.append(i, file);
});

$(':file').on('change', function() {
$.ajax({
    type: 'POST',
    data: data,
    url: 'http://localhost/upload.php',
    cache: false,
    contentType: false,
    processData: false,
    success: function(data){
        alert(data);
    }
});
});
});
&lt;/script&gt; 
</code></pre>
