Client validation of INPUT of type FILE without postback using jQuery
- by Fixer
I want to check on the client side that a file has been selected before the form can be submitted.
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm("Upload", "Files", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input id="File" name="File" type="file" size="80" />
<input type="submit" name="name" value="Upload" />
}
Currently this form is doing postbacks for validation. What is going wrong?