title: Add files upload to basic form AJAX
body: <p>I have a working Ajax form, now I'm trying to add file upload to it but it doesn't work. The file isn't uploaded or found in the <code>$_FILES</code> array. The code is pretty straight-forward so I don't know what I could be doing wrong. I'm giving the HTML, AJAX and PHP code here, but since the HTML and PHP are so simple, I think I must be missing something in the Ajax function since I don't have much experience with that. I can fetch all data from the form but not file.</p>
  
  <p>In developer mode
  <a href="https://i.stack.imgur.com/7RKwW.png" rel="nofollow noreferrer">There is no business_docs data in parameters</a></p>
  
  <p><strong>HTML CODE</strong></p>
  
  <pre><code>&lt;form class="well form-horizontal" action="rejestracja/nowy" method="post" enctype="multipart/form-data" id="contact_form"&gt;
      &lt;input name="user_email" placeholder="Adres E-mail" class="form-control"  type="text" required&gt;
      &lt;input name="user_phone" placeholder="" class="form-control" type="text"&gt;
      &lt;input name="business_docs" placeholder="" class="form-control" type="file"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>AJAX CODE</strong></p>
  
  <pre><code>// Get the form instance
  var $form = $(e.target);
  
  // Get the BootstrapValidator instance
  var bv = $form.data('bootstrapValidator');
  
  // Use Ajax to submit form data
  $.ajax({
      url: $form.attr('action'),
      type: 'POST',
      cache: false,               
      data: $form.serialize(),
      dataType    : 'json'
  })
  </code></pre>
  
  <p><strong>PHP CODE</strong></p>
  
  <pre><code> if ( !isset($_POST['business_docs'])) 
   {
       $data['success'] = false;
       $errors['files_upload'] = 'Dodanie pliku nie powiodło się, spróbuj ponownie';
       $data['errors']  = $errors;                    
       echo json_encode($data);
  
       return false;
  
  }
  
  else
  {
       move_uploaded_file($_POST['business_docs']['tmp_name'], '../../uploads/' . $_FILES['file']['name']);
  
  }
  </code></pre>