title: How to use FormData in jquery for uploading files?
body: <p>I have html form:</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" id="formUpload"&gt;
  &lt;input type="file" name="file" /&gt;
  &lt;button type="submit" id="sub"&gt;Click&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My script:</p>
  
  <pre><code> $(function() {
          $("#sub").on("click",function () {
              var form = $("#formUpload")[0];
              var formData = new FormData(form);
              $.ajax({
                  url: 'upload.php',
                  data: formData,
                  type: 'POST',
                  contentType: false,
                  processData: false,
                  dataType: 'html',
                  success: function(data) {
                     $("#res").html(data);
                  }
              });
          });
      });
  </code></pre>
  
  <p>I try to upload file in upload.php, but all is wrong. 
  How can I get $_FILES variable? </p>