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.

import viktor as vkt


class Parametrization(vkt.Parametrization):
file = vkt.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.

import viktor as vkt


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