title: Validation for input type file doesn't work in ASP.NET MVC 4
body: <p>I have the following model: </p>
  
  <pre><code> public class AModel
     {
        [ServerFileVerification( 1, FileType.TEST )]
        public HttpPostedFileBase[] Files
        {
           get;
           set;
        }
     }
  </code></pre>
  
  <p>The attribute:</p>
  
  <pre><code>public class ServerFileVerificationAttribute : RequiredAttribute 
  {
  
     public ServerFileVerificationAttribute( ushort maximumNumberOfFiles, FileType fileType )
        {
           _maxFiles = maximumNumberOfFiles;
           _fileType = fileType;
        }
  
      public override bool IsValid( object value ) {
          HttpPostedFileBase[] files = value as HttpPostedFileBase[];
          string[] extensions = fileType == FileType.TEST ? {".zip"} : { ".txt" };
  
          foreach ( HttpPostedFileBase file in files ) {
             if(file == null ) continue;
             if ( !extensions.Contains( Path.GetExtension( file.FileName ) ) ) {
                       base.ErrorMessage = "The file " + file.FileName + " is invalid";
                       return false;
             }
          } 
      }
  }
  </code></pre>
  
  <p>And the view:</p>
  
  <pre><code>@using ( Html.BeginForm( "Test", "Test", FormMethod.Post, new { enctype = "multipart/form-data" } ) ) {
  
     for ( int i = 0; i &lt; 5; i++ ) { 
        @Html.TextBoxFor( item =&gt; item.Files[i], new { type = "file" } );
        @Html.ValidationMessageFor( item =&gt; item.Files[i] )
        &lt;br /&gt;
     }
  
     &lt;input type="submit" /&gt;
  }
  </code></pre>
  
  <p>Controller: </p>
  
  <pre><code>[HttpPost]
        public ActionResult Test( AModel model )
        {
           if ( ModelState.IsValid ) {
              return Redirect( "http://www.google.ro" );
           }
  
           return View( "Index", model );
        }
  </code></pre>
  
  <p>If I upload anything else than ZIP then should display an error, but it doesn't...</p>
  
  <p>Where is my mistake ? I put ValidationMessageFor but it doesn't work ... Why ?</p>