title: AJAX uploading files not working
body: <p>I want to upload text files on browser using ajax but I'm not getting how to do that. The file is not uploaded and var_dump($files) echoes array(0).</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form id="uploadsql" action="upload.js" method="post" enctype="multipart/form-data"&gt;
      &lt;input id="uploadFile" type="text" disabled="disabled" placeholder="Choose File" /&gt;
      &lt;div  class="fileUpload btn btn-primary"&gt;
          &lt;span&gt;Upload&lt;/span&gt;
          &lt;input id="uploadBtn" name="file" type="file" class="upload"required /&gt;
      &lt;/div&gt;
  
      &lt;div class="fileUpload btn btn-primary"&gt;
          &lt;span&gt;Submit&lt;/span&gt;
      &lt;input type = "submit" id="uploadBtn" class="upload" /&gt;&lt;/div&gt;
  
      &lt;/form&gt;
      &lt;h4 id='loading' &gt;Loading...&lt;/h4&gt;
      &lt;div id="message"&gt;&lt;/div&gt;
      &lt;script type="text/javascript"&gt;  
              document.getElementById("uploadBtn").onchange = function () {  
                  document.getElementById("uploadFile").value = this.value;
              };
      &lt;/script&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$(document).ready(function (e) {
  $("#uploadsql").on('submit',(function(e) {
  e.preventDefault();
  $("#message").empty();
  $('#loading').show();
  $.ajax({
  url: "upload.php", // Url to which the request is send
  type: "POST",             // Type of request to be send, called as method
  cache: false,             // To unable request pages to be cached
  success: function(data)   // A function to be called if request succeeds
  {
  $('#loading').hide();
  $("#message").html(data);
  }
  });
  }));
  
  
  });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  set_time_limit(0);
  header('content-type: text/html; charset=utf-8');
  header("access-control-allow-origin: *");
  
  include 'connect.php';
  
  
  if(isset($_FILES["uploadBtn"]["type"]))
  {
  echo 'yes';
  
  } else {
      $files = $_FILES;
      var_dump ($files);
  }
  
  
  
  ?&gt;
  </code></pre>
  
  <p>What am I doing wrong here?
  Thanks in advance!</p>