[Answered ]-Django file upload form with single button

2👍

Using JavaScript/jQuery:

<form>
    <input type="file" class="autosubmit" />
</form>

And then apply the following:

$('form .autosubmit').on('change', function() {
   this.form.submit();
});

Without jQuery it’s very similar, you’ll just need to use EventTarget.addEventListener.

Leave a comment