Introduction

The File Type Validator plugin validates uploaded files based on the configured list of allowed file types and their associated MIME types.

This plugin is created with the use of Apache Tika to validate the uploaded files.

This plugin source code is available in JogetOSS repository at https://github.com/jogetoss/file-type-validator.


File Type Validator Properties

Configure File Type Validator

Name

Description

MandatoryWhen checked, field must be filled. 
Allowed File TypesGrid to hold File Type Name and MIME Type.
File Type NameName of file type to uniquely identify the MIME Type.
MIME TypeMIME Type based on the list of the link below.
ReferenceFor the full list of file types and their MIME types, click here.
Error Message to Show When Validation FailCustom error message to show when validation fail.



Plugin Usage

1. Add a File Upload element into a Form 

Figure 1: File Upload element in Form Builder


2. Under Advanced Options, choose the File Type Validator

Figure 2: File Type Validator Plugin Configurations


3. Fill in the necessary details. For the list of MIME types, please refer to Media Types (iana.org) which is under the Reference section. We can add multiple allowed file types.


4. Save and return to UI. Try to upload a file type which is allowed.

Figure 3: Uploading an allowed file type

Figure 4: Successfully uploaded


5. If you upload a file type which is not allowed, Invalid File Type(s) error will be shown.

Figure 5: Failed to upload a file type which is not allowed


6. If you upload a double file extension type, it will check the file magic number to perform validation

Figure 6: Failed to upload a double extension file 



  • No labels