5

I am searching for a jQuery script that selects a file when the form is automatic submitted.

bpeterson76
  • 12,918
  • 5
  • 49
  • 82
Mango
  • 175
  • 9
  • 18
  • Possible duplicate of [How do I auto-submit an upload form when a file is selected?](https://stackoverflow.com/questions/7321855/how-do-i-auto-submit-an-upload-form-when-a-file-is-selected) – slartidan Feb 25 '19 at 19:06

1 Answers1

12

Try .change() event for the input file control. Something like

<form action="test.html" id="form1">
    <input type="file" id="fil1" />
</form>

$(function(){
    $("#fil1").change(function(){
        $("#form1").submit();
    });
});
rahul
  • 184,426
  • 49
  • 232
  • 263