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
Post a Comment