File Uploader
Introduction
The File Uploader enables you to upload files or images by dragging and dropping them onto the widget, or by using the file selection dialog box.
It supports multi-file uploading, and includes an image-only mode that previews thumbnails of the uploaded images. The module comes with a domain model containing the entities and nanoflows it needs to function properly.
Setup
Read below for either simple setup instructions, or a more advanced setup (needed when modifying the context entity is not possible).
Simple Setup
For a simple setup, the context entity needs to be a specialization of the FileUploader.FileUploadContext entity. This allows you to use the nanoflows and entities provided with the module:
- In your domain model:
- Set the generalization of the context entity to FileUploader.FileUploadContext.
- On your page:
- Place the FileUploader widget.
- Set the Associated files property to FileUploader.UploadedFile or FileUploader.UploadedImage, depending on the upload mode.
- Set the Action to create new files property to one of the nanoflows shipped with the module, depending on the upload mode.
Advanced Setup
For an advanced setup, useful when modifying the context entity is not possible, follow these steps:
- In your domain model:
- Create a new specialized image/file entity by setting its generalization to System.FileDocument or System.Image, depending on the upload mode.
- Create a many-to-one association from this image/file entity to your context entity.
- In the App Explorer / Logic Editor:
- Copy one of the two nanoflows (depending on the upload mode) from the module and modify it to use your context entity and the newly created file/image entity.
- On your page:
- Place the FileUploader widget.
- Set the widget property Associated files to the newly created file/image entity.
- Set the widget property Action to create new files to the modified nanoflow.
Widget Configuration
General Tab
Upload mode
- Files - Allows all file types by default, and adds a configuration option to specify a custom set of allowed file types.
- Images - Limits uploads to images and shows a preview thumbnail.
Associated Files / Associated Images
- Defines the entity which is used to store the files or images. Needs to be a specialization of System.FileDocument or System.Image.
- By default, use FileUploader.UploadedFile for upload mode Files and FileUploader.UploadedImage for upload mode Images.
Action to Create New Files
- Configuration to set up the nanoflow which creates an associated file object and commits it.
- By default, calls Nanoflow ACT_CreateUploadedFileDocument for a Files upload mode and ACT_CreateUploadedImageDocument for an Images upload mode.
Allowed File Format
This configuration is only shown for the Files upload mode. Users can manually set restrictions on the allowed file types.
Maximum Number of Files
This configuration sets a limit on how many files can be uploaded at once.
Maximum File Size (MB)
This configuration sets a maximum limit on the file size of uploaded files.
Text Tab
Configures the displayed text used in File Uploader.
Nanoflows
This module includes two predefined nanoflows:
ACT_CreateUploadedFileDocument
This nanoflow will attach an uploaded file to the context object.
ACT_CreateUploadedImageDocument
This nanoflow will attach an uploaded image to the context object.