Skip to content
masterclass Buddy

React Testing Library · Method

userEvent.upload

userEvent.upload simulates selecting one or more files in a file input. Await it, then inspect the input's files collection.

Last updated

Syntax

upload(element: HTMLElement, fileOrFiles: File | File[]): Promise<void>

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • @testing-library/user-event
  • userEvent.setup()
  • File
  • input.files
  • applyAccept
  • accept
  • multiple

Source: Utility APIs | Testing Library. Checked 2026-11-03.