title: HTML prevent from redirect upload php
body: <p>I need to prevent the page redirected to the upload php when click upload button.</p>
  
  <p>How can I  do this in below code. </p>
  
  <pre><code>&lt;form id="myForm"  action="http://example/DB_1/AccessWeb/file_upload.php" method="post" enctype="multipart/form-data"&gt;
      Select image to upload:
      &lt;input type="file" name="fileToUpload" id="fileToUpload1"&gt;
  &lt;/form&gt;
  
  &lt;button onclick="myFunction()"&gt;  Upload
  &lt;/button&gt;
  
  &lt;script&gt;
  
  function myFunction(){
  
    document.getElementById("myForm").submit();
  
  
  }
  &lt;/script&gt;
  </code></pre>