tags:

views:

38

answers:

1

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
<%=FileUpload1.ClientID%>" is this right syntax?
Lalit
<%#FileUpload1.ClientID%>" thre must be '#' rather than '=' i think right?.
Lalit

related questions