title: $_files array is empty on submit with javascript
body: <p>I am facing issue while submitting form, i am getting empty $_FILES array. I have javascript attached with this form where i m trying to upload images and other user inputs, with javascript i am getting empty array but on other hand if i submit form without attaching javascript so same form $_FILES array showing data normally.. </p>
  
  <p>here i am posting my form and javascript can anyone help me to figure out whats wrong in my javascript which prevents post to send $_FILES array.. ?</p>
  
  <p><strong>script.js</strong></p>
  
  <pre><code>$(function(){
  "use strict";
  $('.form1').on('submit', function( event ){
      event.preventDefault();
  
      var form = $(this); 
      submitForm(form);   
      });
  function submitForm(form){
      "use strict";
      $("button").click(function(){
          $("#loader").html('&lt;img src="img/ajax-loader.gif"&gt;');
      });
  
      $.ajax ({
              url: form.attr('action'),
              method: form.attr('method'),
              data: form.serialize(),
              success: function(response) {
                  response = $.parseJSON( response );
  
                  if(response.success){       
                          if(!response.signup){
                              setTimeout(function(){
                              $("#loader").html(response.message);    
                              window.location = response.url; 
                          }, 1000);
  
                  }
                      else{
                      $("#loader").html(response.message);}
                  }
                  else if(response.error){
                      $("#loader").html(response.message);
  
                  } 
                  else if(response.missing_fields){
                      $("#loader").html(response.message);
  
                  }   
  
              }
  
          });
  }
  </code></pre>
  
  <p><strong>Here is my HTML Code (add_user.php):</strong></p>
  
  <pre><code>&lt;form method="POST" action="/pms/admin/user-register.php" class="form1" enctype='multipart/form-data'&gt;
                  &lt;div class="row"&gt;
                  &lt;div class="float-right col-md-12" &gt;&lt;span&gt;User Details:&lt;/span&gt;&lt;a href="users.php"&gt;&lt;span class="btn btn-danger float-right"&gt;Back&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
  
                  &lt;/div&gt;
                  &lt;hr&gt;
                     &lt;div class="row"&gt; 
                        &lt;div class="form-group col-md-6"&gt;
                          &lt;label  for="firstName"&gt;First Name:&lt;/label&gt;
                          &lt;input type="text" class="form-control" id="firstName" name="firstName" placeholder="Enter First Name"&gt;
  
                        &lt;/div&gt;
                        &lt;div class="form-group col-md-6"&gt;
                          &lt;label for="lastName"&gt;Last Name:&lt;/label&gt;
                          &lt;input type="text" class="form-control" name="lastName" id="lastName" placeholder="Enter Last Name"&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                      &lt;div class="row"&gt; 
                        &lt;div class="form-group col-md-6"&gt;
                          &lt;label  for="firstName"&gt;Mobile Number:&lt;/label&gt;
                          &lt;input type="text" class="form-control" id="mobNumber" name="mobNumber" placeholder="Enter Mobile No"&gt;
  
                        &lt;/div&gt;
                        &lt;div class="form-group col-md-6"&gt;
                          &lt;label for="lastName"&gt;Email Address:&lt;/label&gt;
                          &lt;input type="email" class="form-control" name="email" id="email" placeholder="Enter Email"&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
  
                      &lt;div class="row"&gt; 
                          &lt;div  class="form-group col-md-6"&gt;
                          &lt;div class="filediv"&gt;
                             &lt;label for="lastName"&gt;User Documents:&lt;/label&gt;&lt;br&gt;
                             &lt;input class="fomr-control-file" type="file" name="files[]" id="file" multiple&gt;&lt;br&gt;&lt;br&gt;
                             &lt;input type="button" id="add_more" class="btn btn-sm btn-secondary" value="+ Add More Files"/&gt;
                          &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;br&gt;
                    &lt;h6&gt;Login Details:&lt;/h6&gt;&lt;hr&gt;
                     &lt;div class="row"&gt; 
                        &lt;div class="form-group col-md-6"&gt;
                          &lt;label  for="firstName"&gt;User Type:&lt;/label&gt;
                          &lt;select class="form-control" name="userType"&gt;
                              &lt;option value="user-type" disabled selected&gt;Select User Type..&lt;/option&gt;
                              &lt;option value="administrator"&gt;Administrator&lt;/option&gt;
                              &lt;option value="user"&gt;Regular User&lt;/option&gt;
                          &lt;/select&gt;
                        &lt;/div&gt;
                        &lt;div class="form-group col-md-6"&gt;
                          &lt;label for="lastName"&gt;User Name:&lt;/label&gt;
                          &lt;input type="text" class="form-control" name="userName" id="userName" placeholder="Enter Last Name"&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;    
                    &lt;div class="row"&gt; 
                        &lt;div class="form-group col-md-6"&gt;
                          &lt;label  for="firstName"&gt;Password:&lt;/label&gt;
                          &lt;input type="password" class="form-control" name="password" placeholder="Enter Password"&gt;
  
                        &lt;/div&gt;
                        &lt;div class="form-group col-md-6"&gt;
                          &lt;label for="lastName"&gt;Repeat Password:&lt;/label&gt;
                          &lt;input type="password" class="form-control" name="cpassword"  placeholder="Renter Password"&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;    
  
                    &lt;button type="submit" class="btn btn-primary" name="submit" id="upload"&gt;Submit&lt;/button&gt;
                        &lt;div id="loader" style="margin-top:40px; position:relative; text-align:center;"&gt;&lt;/div&gt;
  
                  &lt;/form&gt;
  </code></pre>