title: Asp.net MVC - input type="file" validation error
body: <p>i create a form that have 2 input text and 1 input file, when i selected the image and click on submit button an error occurs for the input file </p>
  
  <p>i don't have any validation on input file!</p>
  
  <p><a href="https://i.stack.imgur.com/NOMP9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NOMP9.png" alt="validation error"></a></p>
  
  <p>this is my view code:</p>
  
  <pre><code>@model Test.Models.Domain.tblCategory
  @{
                  Layout = null;
  }
  @using (Html.BeginForm("AddOrEditeCat", "Admin", FormMethod.Post, new {enctype="multipart/form-data",onsubmit="return SubmitCatForm(this)" }))
  {
      @Html.AntiForgeryToken()
  
      @Html.HiddenFor(model =&gt; model.id)
      @Html.HiddenFor(model =&gt; model.Pic)
  
      &lt;div class="form-group"&gt;
          @Html.Label("Title", new { @class = "control-label" })
          @Html.EditorFor(model =&gt; model.Title, new { htmlAttributes = new { @class = "form-control" } })
          @Html.ValidationMessageFor(model =&gt; model.Title)
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          @Html.Label("Text", new { @class = "control-label" })
          @Html.EditorFor(model =&gt; model.Text, new { htmlAttributes = new { @class = "form-control" } })
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
      @Html.LabelFor(model=&gt;model.Pic, new { @class = "control-label" })
          &lt;img src="@Url.Content(Model.Pic)" style="margin:10px" height="150" width="150" id="imagePreview" /&gt;
          &lt;input type="file" id="ImageUpload" name="ImageUpload" accept="image/jpeg,image/png" onchange="ShowImagePreview(this,document.getElementById('imagePreview'))" /&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;input type="submit" value="Submit" class="btn btn-primary" /&gt;
          &lt;input type="reset" value="Reset" class="btn btn-primary btn-danger" /&gt;
      &lt;/div&gt;
  
  }
  </code></pre>
  
  <p>and this is my model:</p>
  
  <pre><code>public partial class tblCategory
  {
      public int id { get; set; }
      [Required(ErrorMessage = "*")]
      public string Title { get; set; }
      public string Text { get; set; }
      [DisplayName("Image")]
      public string Pic { get; set; }
  
      public HttpPostedFileBase ImageUpload { get; set; }
  
      public tblCategory()
      {
          Pic = "~/Cntent/upload/img/cat/defalt.png";
      }
  }
  </code></pre>