How do I auto-submit an upload form when a file is selected?

You can simply call your form’s submit method in the onchange event of your file input.

document.getElementById("file").onchange = function() {
    document.getElementById("form").submit();
};

http://jsfiddle.net/cwvc4/73/

Leave a Comment