Displaying posts tagged with

“validation”

Validate max file size during upload in asp.net mvc

Just a quick sketch. Validation is done as an Attribute (DataAnotations way). public class FileAttribute : ValidationAttribute { public int MaxContentLength = int.MaxValue; public string[] AllowedFileExtensions; public string[] AllowedContentTypes; public override bool IsValid(object value) { var file = value as HttpPostedFileBase; //this should be handled by [Required] if (file == null) return true; if (file.ContentLength [...]

Share

Tips for jQuery validation plugin

Because I currently work with a couple of projects where I extensively use jQuery framework, together with it’s plugins I decided to write a post in which I can gather all of my ideas, tips that i have arrived during my work with this library.  I am a kind of guy that has a huge [...]

Share