Introduction
Data Modules in Corteza are built with data fields. There are many different types of data fields. Each Field Type can have:
Attributes. These allow us to customize a Field Type to our needs e.g. turn a number into a measure of currency or weight.
Sanitizers. These allow us to clean up data before it is saved e.g. round a number with 7 decimal places to a number with 2 decimal places.
Validators. These allow us to determine if a field value is a valid entry or not e.g. someone's age should not be a negative number.
This guide concerns itself only with Attributes for the named Field Type. Sanitizer and Validators are the subject of a separate guide which can be found here.
To access Data Modules, click on the "Admin Panel" on the top of the left menu bar in any Corteza app.
The File Upload Field Type
The File Upload Field type in Corteza provides a box for uploading or dragging-and-dropping files, clickable links to uploaded files and different presentation formats for the files. Once the "File upload" type has been selected in the "Edit Module" page, click on the Wrench icon to the right of the field type in order to tailor its attributes.
In the "General" tab, it's worth considering if you wish to allow multiple file uploads to your individual records - this requirement is common. To do so, tick the "Multi value" checkbox.
The "File upload" tab presents a range of viewing options, a "File type allow list" for limiting which file types can be uploaded, and a line for entering "Maximum file size".
Selecting the "List" view will result in the following file upload layout in a block.
Selecting the "Grid" view will result in the following file upload layout in a block.
Selecting the "Single image" view will result in the following file upload layout in a block.
Selecting the "Gallery of images" view will result in the following file upload layout in a block.
The "Hide file name" checkbox only works for the "Single image" and "Gallery of images" options. It is grayed out for the "List" and "Grid" views.
The "File type allow list" requires Mime types. A comprehensive reference for common Mime types can be found here.
Images (.jpeg, .png) and PDF's can be displayed and viewed in Corteza. Clicking on them will open them in the interface. In the case of large files or PDF's, the first number of pages will be displayed and an option to download will be available in the top left hand corner.
Once you have made your choices, hit "Save and close". When back in the "Edit Module" page, hit "Save" again to save the Module changes.