diff --git a/src/Common/FileSystem.ts b/src/Common/FileSystem.ts index 275005362..5bc79e1af 100644 --- a/src/Common/FileSystem.ts +++ b/src/Common/FileSystem.ts @@ -358,13 +358,13 @@ export class FileSystem */ static ChooseFile({ filter, multiple = false, callback }: { filter?: string; multiple?: boolean; callback: (filelist: FileList) => void; }) { - if (!this.chooserInput) - { - this.chooserInput = document.createElement("input"); - this.chooserInput.type = "file"; - this.chooserInput.style.display = "none"; - document.body.appendChild(this.chooserInput); - } + if (this.chooserInput) + this.chooserInput.remove(); + + this.chooserInput = document.createElement("input"); + this.chooserInput.type = "file"; + this.chooserInput.style.display = "none"; + document.body.appendChild(this.chooserInput); this.chooserInput.accept = filter; this.chooserInput.onchange = () =>