Toloka documentation


toloka.client.project.template_builder.fields.MediaFileFieldV1 | Source code

    data: Optional[BaseComponent] = None,
    accept: Optional[Union[BaseComponent, Accept]] = None,
    multiple: Optional[Union[BaseComponent, bool]] = None,
    hint: Optional[Any] = None,
    label: Optional[Any] = None,
    validation: Optional[BaseComponent] = None,
    version: Optional[str] = '1.0.0'

Adds buttons for different types of uploads: uploading photos or videos, selecting files from the file manager or choosing from the gallery.

In the accept property, select which buttons you need.

By default, only one file can be uploaded, but you can allow multiple files in the multiple property.

This component is convenient when using mobile devices. To upload files from a computer, it's better to use field.file for a more flexible configuration of the file types.

Parameters Description

Parameters Type Description
data Optional[BaseComponent]

Data with values that will be processed or changed.

accept Optional[Union[BaseComponent, Accept]]

Adds different buttons for four types of uploads. Pass the true value for the ones that you need. For example, if you need a button for uploading files from the gallery, add the "gallery": true property

multiple Optional[Union[BaseComponent, bool]]

Determines whether multiple files can be uploaded:

hint Optional[Any]

Hint text.

label Optional[Any]

Label above the component.

validation Optional[BaseComponent]

Validation based on condition.


How to allow Tolokers to upload images and make photos.

image_loader = tb.fields.MediaFileFieldV1(
    label='Upload a photo','image'),
    accept=tb.fields.MediaFileFieldV1.Accept(photo=True, gallery=True),