I'm trying to subclass ValidationAttribute
in ASP.NET MVC 2 to make something along the lines of an ImageValidator
class which would make sure that an uploaded image (from <input type="file">
) has the correct mimetype, doesn't exceed the maximum allowed file size, etc.
So where do I start? I get the feeling like images are an exception when it comes to ASP.NET MVC validation attributes and that you always have to manually figure out ways to validate them. For example, what type should the property in my model/view model have?