File Field

Illustrated drawing of Amadeus Maxmimilian StadlerIllustrated drawing of Amadeus Maxmimilian Stadler

Amadeus Stadler

Published August 25, 2021

The FIle field allows adding files to your content. You can use it to add files from anywhere in your repository and even restrict it to a specific folder.

Editing UI Widget

This field is displayed as a button labelled with the field’s label, which opens a file picker when clicked. Once a file was selected, its path will be visible along with an option to remove the file if the removable option is set to true.

Output Format

The File field outputs the path of the file in the current project as a string.

Options

The following options are available for this field (default values shown):

{
  "removable": false,
  "root": null,
  "filetypes": ["pdf", "zip"]
}
  • removable: whether or not the file may be removed after being set, resetting the field’s value to null

  • root: the root folder from which to pick files, defaults to the root of the project, but may be any folder within it

  • filetypes: an array of file extensions without a leading dot that may be added to this field. For performance reasons, be aware that this only compares the extension of the file name!

Validation

The following validation options are available for this field (default values shown):

{
  "max": 1,
  "required": false,
  "unit": "filesize (MB)"
}

Notes

If you are looking for a way to add an image to your content instead, the Image field is what you are looking for.

Setting the root option to the same directory as your Media Library will allow you and your collaborators to also upload new files to your project.

Version History

  • Version at launch: 1