title: jQuery multiple file upload from scratch
body: <p>I am trying to implement a multiple image uploader in jQuery using the new HTML5 <strong>multiple</strong> attribute.</p>
  
  <p>My code is the following:</p>
  
  <pre><code>&lt;form action="file-upload.php" method="post" enctype="multipart/form-data"&gt;
      &lt;input name="userfiles" type="file" multiple="multiple"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The JS code I am using is taken from a discussion here on SO, and is the following:</p>
  
  <pre><code> $('input[name=userfiles]').change(function() {
      var names = [];
      for (var i = 0; i &lt; $(this).get(0).files.length; ++i) {
          names.push($(this).get(0).files[i].name);
          console.log(names[i]);
      }
   });
  </code></pre>
  
  <p>With this I am able to print on the console the file names I select, but what if I need to get the exact val() of those files? I tried replacing <strong>.name</strong> with <strong>.val()</strong>, but I get an error.</p>
  
  <p>I think I would need a <strong>fakepath</strong> of every single file if I want to be able to work with them with <strong>$.ajax</strong>. If this is correct, how can I cycle though them in the PHP file where the get request is sent, in order to upload them?</p>