title: Data Annotations Extensions MV3 ModelState not valid
body: <p>I am using DataAnnotationsExtensions from <a href="http://dataannotationsextensions.org/" rel="nofollow">http://dataannotationsextensions.org/</a></p>
  
  <p>with an example from here <a href="http://weblogs.asp.net/srkirkland/archive/2011/02/23/introducing-data-annotations-extensions.aspx" rel="nofollow">http://weblogs.asp.net/srkirkland/archive/2011/02/23/introducing-data-annotations-extensions.aspx</a></p>
  
  <p>Controller Code </p>
  
  <pre><code>    public ActionResult Create(Dog dog, HttpPostedFileBase Picture)
      {
          Regex rgx = new Regex(@"^.*\.(jpg|gif|jpeg|png)$");
          Match m = rgx.Match(Picture.FileName);
  
          if (rgx.IsMatch(Picture.FileName))
              {
                  if (ModelState.IsValid)
                  {
  </code></pre>
  
  <p>Model Code </p>
  
  <pre><code>[FileExtensions("png|jpg|jpeg|gif", ErrorMessage = "Only jpg jpeg gif or png files allowed")]
          public string Picture { get; set; }
  </code></pre>
  
  <p>and the razor code</p>
  
  <pre><code>@Html.TextBoxFor(model =&gt; model.Picture, new { type = "file" })
  @Html.ValidationMessageFor(model =&gt; model.Picture)
  </code></pre>
  
  <p>Everything I do it fails everytime at </p>
  
  <pre><code>if (ModelState.IsValid)
  </code></pre>
  
  <p>If I remove the FileExtensions Annotation it works fine but then I no longer have the ability to block file types that I dont want. </p>
  
  <p>I have gone as far as to check the code for the data annotations extentions located here
  <a href="https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/FileExtensionsAttribute.cs" rel="nofollow">https://github.com/srkirkland/DataAnnotationsExtensions/blob/master/DataAnnotationsExtensions/FileExtensionsAttribute.cs</a></p>
  
  <p>and I still cant seem to find out where the problem is.</p>