Skip to content

Commit d111d19

Browse files
authored
Merge pull request mendix#8809 from gjulivan/development
[WC-2663] Add file uploader documentation
2 parents f6c3d1c + afb33bb commit d111d19

2 files changed

Lines changed: 108 additions & 0 deletions

File tree

  • content/en/docs/appstore/use-content/platform-supported-content/modules
  • static/attachments/appstore/platform-supported-content/modules/file-uploader
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
title: "File Uploader"
3+
url: /appstore/modules/file-uploader/
4+
description: "Describes the configuration and usage of the File Uploader module, which is available in the Mendix Marketplace."
5+
#If moving or renaming this doc file, implement a temporary redirect and let the respective team know they should update the URL in the product. See Mapping to Products for more details.
6+
---
7+
8+
## Introduction
9+
10+
The [File Uploader](https://marketplace.mendix.com/link/component/235351) enables you to upload files or images by dragging and dropping them onto the widget, or by using the file selection dialog box.
11+
12+
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.
13+
14+
{{< figure src="/attachments/appstore/platform-supported-content/modules/file-uploader/fileuploader.png" class="no-border" >}}
15+
16+
## Setup
17+
18+
Read below for either [simple setup](#simple-setup) instructions, or a more [advanced setup](#advanced-setup) (needed when modifying the context entity is not possible).
19+
20+
{{% alert color="info" %}}
21+
In the following sections, the term "context entity" refers to the entity of the context object in which the file uploader widget is placed. This can be either a data view or a page parameter.
22+
{{% /alert %}}
23+
24+
### Simple Setup {#simple-setup}
25+
26+
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:
27+
28+
* **In your domain model**:
29+
1. Set the generalization of the context entity to **FileUploader.FileUploadContext**.
30+
* **On your page**:
31+
1. Place the **FileUploader** widget.
32+
1. Set the **Associated files** property to **FileUploader.UploadedFile** or **FileUploader.UploadedImage**, depending on the upload mode.
33+
1. Set the **Action to create new files** property to one of the nanoflows shipped with the module, depending on the upload mode.
34+
35+
{{% alert color="info" %}}
36+
Starting with File Uploader 2.0, the widget properties will be set automatically.
37+
{{% /alert %}}
38+
39+
### Advanced Setup {#advanced-setup}
40+
41+
For an advanced setup, useful when modifying the context entity is not possible, follow these steps:
42+
43+
* **In your domain model**:
44+
1. Create a new specialized image/file entity by setting its generalization to **System.FileDocument** or **System.Image**, depending on the upload mode.
45+
1. Create a `**\*-1**` association from this image/file entity to your context entity.
46+
* **In the App Explorer / Logic Editor**:
47+
1. 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.
48+
* **On your page**:
49+
1. Place the **FileUploader** widget.
50+
1. Set the widget property **Associated files** to the newly created file/image entity.
51+
1. Set the widget property **Action to create new files** to the modified nanoflow.
52+
53+
### Widget Configuration
54+
55+
#### General Tab {#general}
56+
57+
##### Upload mode
58+
59+
* **Files** – Manually specify allowed file types.
60+
* **Images** - Limits uploads to images and shows a preview thumbnail.
61+
62+
##### Associated Files / Associated Images
63+
64+
* Defines the entity which is used to store the files or images. Needs to be a specialization of **System.FileDocument** or **System.Image**.
65+
* By default, use **FileUploader.UploadedFile** for upload mode Files and **FileUploader.UploadedImage** for upload mode Images.
66+
67+
{{% alert color="info" %}}
68+
Starting with File Uploader 2.0, the widget properties will be set automatically.
69+
{{% /alert %}}
70+
71+
##### Action to Create New Files
72+
73+
* Configuration to setup the nanoflow which creates an associated file object and commits it.
74+
* By default, call **Nanoflow ACT_CreateUploadedFileDocument** for upload mode Files and **ACT_CreateUploadedImageDocument** for upload mode Images.
75+
76+
{{% alert color="info" %}}
77+
Starting with File Uploader 2.0, the widget properties will be set automatically.
78+
{{% /alert %}}
79+
80+
##### Action to Create New Files
81+
82+
This configuration only shown for upload mode **Files**. User can manually set restriction on the allowed file types.
83+
84+
##### Maximum Number of Files
85+
86+
This configuration is to sets a limit on how many files can be uploaded at once.
87+
88+
##### Maximum File Size (MB)
89+
90+
This configuration is to sets a maximum limit on the file size of uploaded files.
91+
92+
#### Text Tab {#general}
93+
94+
Configure the displayed text used in **File Uploader**.
95+
96+
### Nanoflows
97+
98+
This module includes two predefined nanoflows:
99+
100+
#### ACT_CreateUploadedFileDocument
101+
102+
This nanoflow will attach an uploaded file to the context object.
103+
104+
#### ACT_CreateUploadedImageDocument
105+
106+
This nanoflow will attach an uploaded image to the context object.
107+
108+
3.24 KB
Loading

0 commit comments

Comments
 (0)