Currently I have a form with a filemanager, and a button for the user to press; they DnD an image file, then press the button (which runs JS to: look at the filemanager form field, fetch the draft file path and image size, then load it onto the page in a JS widget).
Currently I don't know when a file is added, so they could press the button when there's no file available. I'd like to avoid this - and ideally avoid the user having to press the button at all. I'm hoping the filemanager can fire a JS event (or maybe run a callback) when a file is added - but I can't find any support for this.
My searching for existing info on this only turned up https://moodle.org/mod/forum/discuss.php?d=313972
Any suggestions on how to approach this?