A simple question ... Can I use client-side MVC 3 checking on file type inputs?
To explain: MVC 3 uses its model validation using IClientValidatable and unobtrusive javascript so that you can write server-side validation and render the client side using jquery validation using Microsoft plugins. To make the required property you add the attribute below
[Required] public HttpPostedFileBase CvFile {get; set;}
As long as the client val command and unobtrusive javascript are included in the config, all of this should work on the client.
However, HttpPostedFileBase (i.e. <input type="file" name="Model.CvFile" />) will not be executed on the client side.
Any ideas on how this can be achieved while keeping in touch with server-side validation
Jay
source share