Do note that an input element expose a FileList
(Using files from web applications - Web APIs | MDN) and the imagefile.files[0]
is there for a reason.
It’s likely you get the error because you are testing the action in the editor workflow instead of preview mode.
Check this Filtering Issues - #11 by dorilama and the post after.