title: Submitting a form with a file using JQuery and AJAX
body: <p>I have a form, with a file input, that submits just fine when I use the default action to submit the form. But, when I use JQuery and AJAX to make the call to the PHP file, it does not seem to get the file. Is there something that I need to add for sending files through JQUERY/AJAX?</p>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;form id="photo-form" enctype="multipart/form-data" method="post" action=""&gt;
      &lt;input type="hidden" name="MAX_FILE_SIZE" value="5000000"/&gt;
      &lt;input type="file" class="upload-input" name="upload-new-input" autocomplete="off"/&gt;
      &lt;input type="submit" name="submit" value="submit/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My JQuery:</p>
  
  <pre><code>$(document).ready(function() {
      $("#photo-form").submit(function(e) {
  
          e.preventDefault();
  
          var dataString = $(this).serialize();
  
          $.ajax({  
               type: "POST",  
               url: "uploadcover.php",  
               data: dataString,
               async: false,
               success: function(data) {
                   alert(data);
               }
          }); 
  
      });
  });
  </code></pre>