Edit this page

Validation

As of the Kendo UI 2016 Q3 release the Upload supports file validation—selected files can be validated against their extensions and size.

The following example demonstrates a sample configuration for validation.

Example
    validation: {
        allowedExtensions: [".jpg", ".rar"],
        maxFileSize: 800000,
        minFileSize: 200000
    }

Types of Validation

The Upload supports three types of validation:

File Extension

The allowedExtensions array object lists all file extensions that are allowed. If the user tries to select a file with an extension that is not included in the array, the validation will fail.

The validation messages are displayed differently depending on whether the async.batch option is enabled.

Figure 1: Batch mode is disabled

Validation message on disabled batch mode

Figure 2: Batch mode is enabled

Validation message on enabled batch mode

Maximum File Size

The maxFileSize property defines the maximum size in bytes allowed of a file that is intended for upload to the server. If the selected file exceeds the maximum size, a validation error message, such as File size too large., is displayed.

Minimum File Size

The minFileSize property defines the minimum size in bytes allowed of a file that is intended for upload to the server. If the size of the selected file is less than the minimum size, a validation error message, such as File size too small., is displayed.

Browser Limitations

Internet Explorer versions prior to version 10 provide no information on the file size. As a result, the Upload validation for the minFileSize and maxFileSize options will not work as expected.

See Also

Other articles on the Kendo UI Upload:

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy