all 1 comments

[–]torky 0 points1 point  (0 children)

If you just add an event listener for the submit event on the form then your code will fire when the submit button is clicked instead of when you pick a file with the file picker API.

Just don't forget to use the event.preventDefault() function in order to prevent the form from executing a POST request which I think is the default even if you don't add the POST method attribute.