You can get validate file uploading using JavaScript like this.
<script type="text/javascript">
function validate() {
var uploadcontrol = document.getElementById('<%=FileUploadImg.ClientID%>').value;
var reg = /(.doc|.docx|.pdf)$/i;
if (uploadcontrol.length > 0)
{
if (reg.test(uploadcontrol))
{
document.getElementById('<%=lblFileUploadImg.ClientID%>').innerHTML = "<font color="green">Upload Image File</font>";
return true;
}
else
{
document.getElementById('<%=lblFileUploadImg.ClientID%>').innerHTML = "Error while upload image";
return false;
}
}
}
</script>
<asp:fileupload id="FileUploadImg" runat="server" width="217px" height="20px" xmlns:asp="#unknown" />
<asp:label id="lblFileUploadImg" runat="server" xmlns:asp="#unknown" />
<asp:button runat="server" text="Upload" id="btnupload" onclientclick="return validate();" xmlns:asp="#unknown" />
U can try with
JQuery as well.