title: How send input type file to image upload file using post method in javascript
body: <p>How send input type file to image upload file using post method in JavaScript?
  Blew is the form.</p>
  
  <pre><code>&lt;form action="#" method="post" enctype="multipart/form-data" id="image_upload" name="image_upload"&gt;
      &lt;input type="file" name="myFile" id="myFile" onchange="readURL(this);" required&gt;
      &lt;br&gt;
      &lt;img id="blah" src="#" alt="your image" /&gt;
      &lt;input type="hidden" name="user_id" id="user_id" value="&lt;?php echo $user_id; ?&gt;"&gt;
      &lt;input type="submit" value="Upload"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here blow is JavaScript that I have used for post the Form.</p>
  
  <pre><code>$(document).ready(function(){ 
  $('#image_upload').submit(function(e){
          e.preventDefault();
  
          $.post('getfile_provider.php',$('#image_upload').serialize(),function(data){
              alert(data);
          });
  
      });
  }); 
  </code></pre>
  
  <p>When i send in this method i get in getfile_provider.php file only the user_id value.</p>