Search
Weekend Training
ASP.NET MVC, HTML 5 weekend training, click here
eBook free
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Codes Author
Sat, 31-Jan-2015 Authors
All Time Authors
Vishal@Neeraj
12960
Satyapriyanayak
12160
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 : 1050 | 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
Share this to:

Bookmark It

Comments or Responses


Login to post response