I've tried so many regular expressions for the RegularExpression data annotation to check if the file extension is an image and it always returns false e.g. I've also tried FileExtension attribute but it creates an error on the jquery.validation. I'm using ASP.NET MVC 4 Razor

It always shows as an error so I can't post my form Im using MVC 4 Razor
–
KDMAug 24 '13 at 5:27

I don't know I don't know regular expression syntax very well so I'm not sure
–
KDMAug 24 '13 at 5:30

There will always be some type of javascript error or some such way of telling why something won't work. You either need to enable it in your browser and/or implement logging in your code.
–
ps2goatAug 24 '13 at 5:31

the backslash escapes the '.' and the @ in the front of the strings means the string will be as it is, no C# code replacement will be done. E.g., @"\n" will not insert a new line.
–
ps2goatAug 24 '13 at 5:31

*When you have a single instance of HttpPostedFileBase as an action parameter or a property in model then mapping the file is completely done by the HttpPostedFileBaseModelBinder and no value providers are used in this case. You may think why no value providers are used in this case, it's because the source is single and clear i.e. Request.Files collection.*

nice I'll give that a go and see what I come up with
–
KDMAug 24 '13 at 6:31

That all looks good but I'm just using a string Field for MyImage which is actually called DepartmentImage can you add code for Validating a string instead of HttpPostedFileBase but leave up the code that you have written please.
–
KDMAug 24 '13 at 6:36