Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Codes Author
Sat, 25-Oct-2014 Authors
All Time Authors
Satyapriyanayak
12160
Vishal@Neeraj
8240
Jayakumars
8120

Latest members | More ...


(Statistics delayed by 5 minutes)
 Codes

To Validate the Filetype

Ppathi
Posted by Ppathi under JavaScript on 2/28/2012 7:51:57 AM | Points: 40 | Views : 943 | Status : [Member]

This code will help to find file type, While upload the file and validate client on side

function validate1()

{
var File_Attach = document.getElementById("<%=File_Attach.ClientID%>").value;

if(File_Attach != "")
{
if((File_Attach.indexOf(".pdf") > 0) || (File_Attach.indexOf(".xls") > 0) || (File_Attach.indexOf(".zip") > 0) || (File_Attach.indexOf(".rar") > 0))
{
return true;
}
else
{
alert("only pdf,Excel,Zip,Winrar files are allowed");
return false;
}
}
}


Thanks & Regards,
Pasupathi G
No Pain No Gain
Found interesting? Add this to:



Comments or Responses


Login to post response