In the "edit" state, files can be removed, but the invisible file input will still contain them, so with a regular form post, they are still submitted. Programmatically changing the files property will also have no effect on the input. FileUploaderDropContainer should have the same issue.
A note on a potential fix approach:
The input.files property can be set, but FileList objects cannot easily be constructed (at least last time I checked). A common way around this is to use a DataTransfer.
const data = new DataTransfer();
data.items.add(file);
input.files = data.files;
In the
"edit"
state, files can be removed, but the invisible fileinput
will still contain them, so with a regular form post, they are still submitted. Programmatically changing thefiles
property will also have no effect on the input.FileUploaderDropContainer
should have the same issue.REPL demo
A note on a potential fix approach: The
input.files
property can be set, butFileList
objects cannot easily be constructed (at least last time I checked). A common way around this is to use aDataTransfer
.Related/overlap with:
1774