JavaScript/jQuery FileUploader - File Validation

The FileUploader allows you to restrict the extension (allowedFileExtensions) and size (minFileSize and maxFileSize) of the file being uploaded. Note that the minimum and maximum file sizes should be specified in bytes:

JavaScript
  • $(function() {
  • $("#fileUploaderContainer").dxFileUploader({
  • // ...
  • allowedFileExtensions: [".jpg", ".png"],
  • minFileSize: 1024, // 1 KB
  • maxFileSize: 1024 * 1024 // 1 MB
  • });
  • });

Files are validated on the client. However, you should also implement server-side validation. Refer to the demo below to see an example for an ASP.NET server.

View Demo