Here Mudassar Khan has explained how to perform Client Side validation of HTML FileUpload element using Data Annotations in Model class and jQuery in ASP.Net MVC Razor.
HTML FileUpload element validation will allow upload of only certain files by filtering them using their extensions. This filtering of files will be done using the RegularExpression Data Annotation attribute in Model class.
Chapters:
00:00 Introduction
00:24 Adding Namespace
00:50 Setting Required Data Annotation attribute
01:07 Setting RegularExpression Data Annotation attribute
01:50 Adding Form elements
03:07 Adding ValidationMessageFor for error message
04:20 Adding Post Action Method for saving file
07:07 Enabling Client Side validation
07:27 Bundles Information
08:03 Demo
Blog: http://aspsnip.pet/1799
Code: http://aspsnip.pet/1799?code
Q&A: http://aspsnip.pet/1799?ask
Author: http://aspsnip.pet/1799/?author
Follow us on:
Facebook: http://aspsnip.pet/FB
Instagram: http://aspsnip.pet/IG
Twitter: http://aspsnip.pet/TW
#File #Upload #Validation #DataAnnotation #jQuery #MVC #ASP.Net