title: Image not uploading without submit button
body: <p>I am trying to upload mp3 file to server without using submit button i am using ajax but file not uploading to server.Where i am wrong here is my code </p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function() {
      $('#fileToUpload').change(function(){
          var file_data = $('#fileToUpload').prop('files')[0];   
          var form_data = new FormData();                  
          form_data.append('file', file_data);
          $.ajax({
              url: "modules/phone/newvoicemail.php",
              type: "POST",
              data: form_data,
              contentType: false,
              cache: false,
              processData:false,
              success: function(data){
                  console.log(data);
              }
          });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>In newvoicemail.php i put following code</p>
  
  <pre><code>$src = $_FILES['file']['tmp_name'];
      $file_name = $_FILES['fileToUpload']['name'];
      $file_size =$_FILES['fileToUpload']['size'];
      $file_tmp =$_FILES['fileToUpload']['tmp_name'];
      $file_type=$_FILES['fileToUpload']['type'];
      move_uploaded_file($file_tmp,"voicemail/".$file_name);
  </code></pre>
  
  <p>here is my html code</p>
  
  <pre><code>&lt;form name="voicemailform" action="modules/phone/voicemail.php" method="POST" enctype="multipart/form-data" class="form-inline for-frm"&gt;
  &lt;input type="file" name="fileToUpload" id="fileToUpload"&gt;
  &lt;/form&gt;
  </code></pre>