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.

File component

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

NameDescriptionDatatypeDefault
imageDisplay the uploaded file as image.BooleanFalse
imageSizeDisplay size for uploaded images.String"200"
filePatternPattern or MIME type for allowed file types.String"*"
tableViewWhen true and the component is part of an EditGrid, the component's value is shown (simplified) in the collapsed row of the EditGrid.BooleanFalse
uploadOnlyWhether the uploaded file can be downloaded from the File component.BooleanTrue
multipleAllow the user to upload multiple files when set to True.BooleanFalse

Methods

NameSyntaxDescription
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.
useBase64Uploadobj​.useBase64Upload()Use base64 mode in deployed mode.

See also


1

The files are saved in the session folder. This folder is removed when the application is closed.