asp.net mvc - file input MVC 3 Client-side validation for required -
simple question... possible use client side mvc 3 validation on inputs of type file?
to explain: mvc 3 uses model validation iclientvalidatable , unobtrusive javascript allow write validation on server side , have render client side using jquery validate using microsoft's plugins. make property required add attribute below
[required] public httppostedfilebase cvfile {get; set;} as long client side val , unobtrusive javascript on in config should fire on client.
however httppostedfilebase (i.e. <input type="file" name="model.cvfile" />) not run required on client side.
any ideas how can achieved keeping relationship server side validation
simple answer: httppostedfilebase renders "file" input type security issue and, afaik, not scriptable. there's no support "out of box".
edit: seems popular topic online. http://www.hanselman.com/blog/abacktobasicscasestudyimplementinghttpfileuploadwithaspnetmvcincludingtestsandmocks.aspx
Comments
Post a Comment