I need code snippet of django file upload form with single button. I've found excellent implementation of minimal-django-file-upload-example, but there are two buttons: "Browse" and "Upload". Is there a way to submit the file immediately after browsing without clicking "Upload" button?
Asked
Active
Viewed 2,353 times
1 Answers
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
.

DanielB
- 2,798
- 1
- 19
- 29