title: ASP.NET MVC 3: DataAnnotations.FileExtensionsAttribute not working
body: <p>According to the MSDN documentation, by default the FileExtensionsAttribute (.NET 4.5) should allow me to only upload only jpg,jpeg,gif and png files - which is what I want. </p>
  
  <p>I tried uploading a jpg without the attribute, it works. Great. Then
  I added the attribute to my view model..</p>
  
  <pre><code>[FileExtensions(ErrorMessage = "Please specify a valid image file (.jpg, .jpeg, .gif or .png)")]
  public HttpPostedFileBase ImageFile { get; set; }
  </code></pre>
  
  <p>No joy. The verification fails and the ErrorMessage is shown. On top of that there doesn't seem to be a way to specify any allowed custom file extensions. 
  I ended up extending the FileExtensionsAttribute and using my own verification logic, which works as expected. But why doesn't this way work?</p>
  
  <p>Will post the entire controller and view if required. I used this example as a basis for the uploading logic, but using the DataAnnotations.FileExtensionsAttribute instead of Microsoft.Web.Mvc.FileExtensions.. <a href="https://stackoverflow.com/questions/4843621/how-do-i-upload-images-in-asp-net-mvc">How do I upload images in ASP.NET MVC?</a></p>