Skip to main content

Upload 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, FileField

class 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, MultiFileField

class Parametrization(ViktorParametrization):
files = MultiFileField('Upload files', file_types=['.png', '.jpg', '.jpeg'], max_size=5_000_000)