File Manager
Introduction
A file manager is used to upload and/or download files.
A file manager must be placed inside a data view connected to the entity that is either a System.FileDocument (or a specialization) or an external entity with a Contents
binary attribute.
HasStream
attribute to true
in its metadata.
When uploading a file through the file manager, the FileDocument object will be committed immediately. When used inside a form, this happens on submission.
A form is submitted just before a microflow or nanoflow is called or when the page is saved.
Properties
An example of file manager properties is represented in the image below:
File manager properties consist of the following sections:
Common Section
Design Properties Section
Editability Section
Editability determines whether an end-user can change the value in an input widget.
For more information on properties of this section, see the Editability Section section of Properties Common in the Page Editor.
General Section
Type
The Type property indicates how the end-user will be able to use the file manager.
Value | Description |
---|---|
Upload | The file manager can only be used to upload a file. |
Download | The file manager can only be used to download a file. |
Both (default) | The file manager can be used to both upload and download a file. |
Max File Size (MB)
Max file size (MB) determines the maximum size of files (in megabytes) that can be uploaded.
Default: 5
Allowed Extensions
You can specify file extensions that users are allowed to upload. If no extension is specified, all file extensions are allowed. Separate multiple extensions by a semi-colon, for example, txt;doc
If a file with an extension that is not allowed is selected, a system text for File manager/dynamic image > Error: incorrect file extension will be shown below the file manager.
Show File in Browser
Show file in browser indicates whether a file will be shown in the browser instead of being downloaded.
Default: False
Label Section
A label describes the purpose of a widget to the end-user.
For more information on properties of this section, see the Label Section section in Properties Common in the Page Editor.
Visibility Section
Visibility determines whether a widget is displayed to the end-user as part of the page.
For more information on properties of this section, see the Visibility Section section in Properties Common in the Page Editor.
Example of File Manager Usage
A file manager needs to be placed in a data view or a snippet that is connected to System.File or is a specialization of it.
For that you can create an entity in your domain model and define that it is a file entity. This is done by the concept of inheritance, sometimes called generalization. By inheriting from System.File your entity gets all the properties of the system file entity.
Do the following:
-
Open your domain model and create an entity that you would like to define as a file entity.
-
Double-click the entity to open its properties.
-
In the Generalization property, click Select.
-
In the Select Entity dialog box, choose System.File and click the Select button.
-
Click OK. Your entity now inherits all properties from the System.File entity you selected:
-
Open a page or a snippet where you would like to place the file manager and add a data view there.
-
Set the file entity you have created in your domain model as data view’s data source.
-
Place the file manager inside the data view. You can reference the page example below: