diff --git a/web/src/components/misc/FileReceiver.svelte b/web/src/components/misc/FileReceiver.svelte index 23547111..7c581035 100644 --- a/web/src/components/misc/FileReceiver.svelte +++ b/web/src/components/misc/FileReceiver.svelte @@ -10,18 +10,16 @@ export let acceptTypes: string[]; export let acceptExtensions: string[]; + let fileInput: HTMLInputElement; const openFile = async () => { - const fileInput = document.createElement("input"); + fileInput = document.createElement("input"); fileInput.type = "file"; fileInput.accept = acceptTypes.join(","); fileInput.click(); - - fileInput.onchange = async (e: Event) => { - const target = e.target as HTMLInputElement; - - if (target.files?.length === 1) { - file = target.files[0]; + fileInput.onchange = async () => { + if (fileInput.files?.length === 1) { + file = fileInput.files[0]; return file; } }; @@ -31,7 +29,7 @@
-