You can get uploaded file's Extension like this and then validate or compare with your predefined list of extensions like this:
if (fileupload1.HasFile)
{
FileInfo finfo = new FileInfo(fileupload1.FileName);
string fileExtension = finfo.Extension.ToLower();
}
Or by javascript you can try like this..
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script language="JavaScript">
function CheckType() {
var id = document.getElementById('fileupload1').value;
if (id != '') {
var myextensions = /(.jpg|.jpeg|.gif)$/i;
if (myextensions .test(id)) {
alert('OK');
}
else {
alert('Invalid file type.')
}
}
}
</script>
</head>
<body>
<asp:FileUpload ID="FileUpload1" runat="server" onChange="CheckType()" />
</body>
</html>