Hi, I want to validate asp FileUpload Control using in asp.net. That should accept only the .xlsx and .xls files. Validations may be on server side or client side. but client side will better. How to do this?
A:
yes.. you can validate by simple client script..
var uploadfile=document.getElementById("<%=FileUpload1.ClientID%>").value;
//get substring to find out extension
var ext= uploadfile.extension //get substring to find out extension
if (ext !=".xls")
{
alert("invalid format.")
return false;
}
Harendra
2010-05-25 12:56:23
<%=FileUpload1.ClientID%>" is this right syntax?
Lalit
2010-05-26 05:57:36
<%#FileUpload1.ClientID%>" thre must be '#' rather than '=' i think right?.
Lalit
2010-05-26 05:58:45