Skip to main content
A user input component that allows users to upload files.

Fields

NameTypeDescriptionOptions
LabelText--
Allowed file typesTextProvides hints for browsers to select the correct file types. You can specify extensions and MIME types separated by comma, or leave empty to accept any file.-
Allow multiple filesBoolean--
Custom CSS classesTextCSS classes, separated by spaces. You can define classes in custom stylesheets.-

Events

Capture changes to this control.
def onchange_handler(state, payload):

# An array of dictionaries is provided in the payload
# The dictionaries have the properties name, type and data
# The data property is a file-like object

uploaded_files = payload
for i, uploaded_file in enumerate(uploaded_files):
	name = uploaded_file.get("name")
    file_data = uploaded_file.get("data")
    with open(f"{name}-{i}.jpeg", "wb") as file_handle:
        file_handle.write(file_data)
I