& Amp; lt; inputtype & quot; file & quot; & amp; gt; & amp; lt; input & amp; gt; After selecting a file, what actions should I use for automatic post ?.
After this control selects a file and wants it to automatically post it, what action should it use?
.
Reply content:
After this control selects a file and wants it to automatically post it, what action should it use?
.
If yourinput[type="file"]
Is inform
Is listening toinput
Ofchange
Event, and then actively call it in the event processing functionform.submit()
. (Ifform
Insubmit
Typebutton
Orinput
It can also trigger theirclick
.)
Ifform
Is a separateinput[type="file"]
You may needchange
The event handler function submitted through ajax (modern browsers can directly useFormData
).
When a file is selected, the onchange event is automatically triggered. You can trigger a function in this event.
Demo
After a file is selected, the change event is triggered. In the callback function of the change event, the form submit method can be triggered.