diff --git a/src/routes/files/+page.svelte b/src/routes/files/+page.svelte
index 1ac9eb908..3c47caa10 100644
--- a/src/routes/files/+page.svelte
+++ b/src/routes/files/+page.svelte
@@ -376,8 +376,7 @@
search_component.select_first()
}
- const onFileSelected = async (e: Event) => {
- const target = e.target as HTMLInputElement
+ const onFileSelected = async (target: HTMLInputElement) => {
if (target && target.files) {
for (let i = 0; i < target.files.length; i++) {
const file = target.files[i]
@@ -627,12 +626,24 @@
hook="button-upload-file"
icon
tooltip={$_("files.upload")}
- on:click={async () => {
- filesToUpload?.click()
+ on:click={() => {
+ const input = document.createElement("input")
+ input.type = "file"
+ input.multiple = true
+ input.style.display = "none"
+
+ input.addEventListener("change", _ => {
+ const files = input.files
+ onFileSelected(input)
+ })
+
+ document.body.appendChild(input)
+ input.click()
+ document.body.removeChild(input)
}}>
- onFileSelected(e)} bind:this={filesToUpload} />
+
{/if}