php - How can I submit a form right after a user chooses a picture? -


i have form , i'm trying figure out how can submit form after user uploads picture , verified picture. trying use javascript verify image being uploaded.

try this:

<script>     function submitformafterimagecheck()     {         if(/(\.jpeg|\.jpg|\.gif|\.png|\.tiff)$/.test(document.getelementbyid("myfile").value))         {             document.getelementbyid("myform").submit();         }         else         {             alert("you can upload image");         }     } </script> 

and html:

<input id="myfile" type="file" onchange="submitformafterimagecheck();" /> 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -