Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Codes Author
Wed, 23-Jul-2014 Authors
Bandi
240
Zondray
40
All Time Authors
Satyapriyanayak
12160
Jayakumars
8120
Niladri.biswas
6000

Latest members | More ...


(Statistics delayed by 5 minutes)

To Validate the Filetype

Ppathi
Posted by Ppathi under JavaScript on 2/28/2012 7:51:57 AM | Points: 40 | Views : 857 | 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