Skip to main content

Upload files

New in v13.0.0

The FileField and MultiFileField allow users to upload one or multiple files

Upload a single file

The FileField lets the user upload a single file. Explicit permission for certain file types can optionally be set using the file_types argument. The max size in bytes of the file to be uploaded can be set with max_size.

from viktor.parametrization import ViktorParametrization, FileFieldclass Parametrization(ViktorParametrization):    file = FileField('Upload a file', file_types=['.png', '.jpg', '.jpeg'], max_size=5_000_000)

Upload multiple files

If multiple files need to be uploaded at the same time, the MultiFileField can be used.

from viktor.parametrization import ViktorParametrization, MultiFileFieldclass Parametrization(ViktorParametrization):    files = MultiFileField('Upload files', file_types=['.png', '.jpg', '.jpeg'], max_size=5_000_000)