The File component
The File
component can be used to upload files. In comparison to the gui_upload
functionality, there are several differences.
- The
File
component does not block the user interface during upload. It also does not trigger an event in the back-end. - For deployed applications, the file is uploaded to the webserver instead of being part of the submission data. This makes the
File
component suitable for uploading larger files.
There are two modes of operation:
- base64: In base64 mode, the selected files are base64 encoded and put in the submission data. This is the default mode for local applications.
- portal: In portal mode, the selected files are uploaded to the portal webserver. Download URLs are provided in the submission data. This is the default mode for deployed applications.
Note: the File
component also offers upload capabilities for a number of cloud storage services. These are not facilitated yet.
In addition to the properties and methods listed below, this component inherits properties and methods from the superclass Component
. For example, any File component has a label
and tooltip
property even though these are not explicitly listed here.
Properties
Name | Description | Datatype | Default |
---|---|---|---|
image | Display the uploaded file as image. | Boolean | False |
imageSize | Display size for uploaded images. | String | "200" |
filePattern | Pattern or MIME type for allowed file types. | String | "*" |
tableView | When true and the component is part of an EditGrid, the component's value is shown (simplified) in the collapsed row of the EditGrid. | Boolean | False |
uploadOnly | Whether the uploaded file can be downloaded from the File component. | Boolean | True |
multiple | Allow the user to upload multiple files when set to True. | Boolean | False |
Methods
Name | Syntax | Description |
---|---|---|
storeUploadedFiles | [payload, filePaths] = File.storeUploadedFiles(metaData, payload, key, Parent=parent, NestedForm=nestedForm) | Use the submission data to save the files in the back-end and provide the local file paths as output1. |
useBase64Upload | obj.useBase64Upload() | Use base64 mode in deployed mode. |
See also
ResultFile
for downloading files.
1
The files are saved in the session folder. This folder is removed when the application is closed.