Limit file types in the File Uploader
How to limit the allowed file types that a user can upload using the FileUploader element
Sometimes we need to limit the type of files a user can upload to our app.
In this article, we'll review how to do it easily.
Add to the page:
- 1.A group 'Group Uploader' with Type of content: file
- 2.Inside that group, add:
- 1.The file uploader element
- 2.Another group 'Group Alert' with a text inside
3. Create a state 'allowed file types' in the FileUploader element:
- type: text
- content: the extentions you want to allow separated by commas (no spaces)
4. Inside the 'Group Alert' add the following text:
The alert content
- 1.Add a workflow When the FileUploader's value is changed. We'll check if the extension is allowed, if it is not, well remove the file and we'll alert the user.
The whole trigger
The condition in detail
2. Inside the workflow, we start by deleting the file. This is important so our app storage is not full of waste.
3. Then we show the 'Group Alert', we schedule the closing of the alert and we reset the Group Uploader to reset the FileUploader.
The whole workflow
The close alert workflow
The implementation in use: