diff --git a/web/src/upload_widget.ts b/web/src/upload_widget.ts index 94406741dc..c795c45731 100644 --- a/web/src/upload_widget.ts +++ b/web/src/upload_widget.ts @@ -79,9 +79,9 @@ export function build_widget( get_file_input().attr("accept", supported_types.toString()); get_file_input().on("change", (e) => { - if (e.target.files?.length === 0) { + if (e.target.files?.[0] === undefined) { $input_error.hide(); - } else if (e.target.files?.length === 1) { + } else if (e.target.files.length === 1) { const file = e.target.files[0]; if (file.size > max_file_upload_size * 1024 * 1024) { $input_error.text( @@ -167,9 +167,9 @@ export function build_direct_upload_widget( get_file_input().attr("accept", supported_types.toString()); get_file_input().on("change", (e) => { - if (e.target.files?.length === 0) { + if (e.target.files?.[0] === undefined) { $input_error.hide(); - } else if (e.target.files?.length === 1) { + } else if (e.target.files.length === 1) { const file = e.target.files[0]; if (file.size > max_file_upload_size * 1024 * 1024) { $input_error.text(