Hi I have this custom validation but with a little diferences at the type of the property to validate and always even if I if meet business rules the value of ModelState is "null" =s ...here's some code

Model

```
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "image")]
        [ValidateFile(Allowed = new string[] { ".png", ".jpeg", ".jpg" },
                      MaxLength = 1024 * 1024 * 3,
                      ErrorMessage = "Please select a PNG , JPEG , JPG image smaller than 3MB")]
public byte[] Photo { get; set; }

```

===========

ValidateFileAtribute

```
public class ValidateFileAttribute : RequiredAttribute
{
    public int MaxLength { get; set; }
    public string[] Allowed { get; set; }

    public override bool IsValid(object **value**)
    {

        var Photo = value as HttpPostedFileBase;
        if (Photo == null)
        {
            return false;
        }

        if (Photo.ContentLength > MaxLength)
        {
            return false;
        }

        if (!Allowed.Contains(Photo.FileName.Substring(Photo.FileName.LastIndexOf('.'))))
        {
            return false;
        }

        return true;

    }

```

HERE'S WHERE VALUE SHOULD NOT BE NULL!! 

Create.cshtml

```
@using (Html.BeginForm("Create", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Restaurant</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.City)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.City)
            @Html.ValidationMessageFor(model => model.City)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Country)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Country)
            @Html.ValidationMessageFor(model => model.Country)
        </div>

         <div class="editor-label">
            @Html.LabelFor(model=>model.Photo)
        </div>
      <div class="editor-field">
        @Html.EditorFor(model=>model.Photo)
        @Html.ValidationMessageFor(model => model.Photo)
        <input name="ImageFile" type="file" id="ImageFile"  />
      </div>
        <p>
            <input type="submit" value="Create"  />
        </p>

    </fieldset>
}

```

any help?