<script type ="text/javascript">
var validFilesTypes=["xlsx", "csv", "xls"];
function ValidateUpload()
{
var file = document.getElementById("<%=FileUpload1.ClientID%>");
var label = document.getElementById("<%=Label1.ClientID%>");
var path = file.value;
var ext=path.substring(path.lastIndexOf(".")+1,path.length).toLowerCase();
var isValidFile = false;
for (var i=0; i<validFilesTypes.length; i++)
if (ext==validFilesTypes[i])
isValidFile=true;
break;
}
if (!isValidFile)
label.style.color="red";
label.innerHTML="Invalid File. Please upload a File with" +
" extension:\n\n"+validFilesTypes.join(", ");
return isValidFile;
</script>