Custom Validation
A sample demonstrating how to create user-defined validation functions for an upload control. In this example, we defined two validation rules: a maximum file size of 200 KB, and allowed types of jpeg, jpg, gif, png, zip.
MaxSizeKB
AllowedFileExtensions
OnSelect
Server-side re-check
Live demo
Try a file over 200 KB or an unsupported type — it is rejected in the browser before any bytes are sent.
Read the guide
Validating file size and file type
Client checks for speed, server checks for safety - and why you need both.