Feb
27
2008
27
2008
File extension validation Javascript
You can use this function to validate the extension of a file, for client side file upload checkes.
// You can specify the file type in the code "valid_extensions = /(.doc|.pdf)$/i;" .
//If you want to add .docx supprt simply add |.docx (ex:(.doc|.pdf |.docx| .your-extension) )
var valid_extensions = /(.doc|.pdf)$/i;
function CheckExtension(fld)
{
if(fld.value) {
if (valid_extensions.test(fld.value)){
return true;
} else {
return false;
}
} else {
return true;
}
}
Tags: java script, Programming
Related Posts
Latest Posts
- Samsung Galaxy S3 Price Revealed
- Introducing Google Drive
- Google Account Activity gives you a monthly summary of your account activity across many Google products
- Apple released iOS 5.1
- You won’t be actually able to take 41MP photos using Nokia 808 PureView
- Apple Releases Mac OS X Mountain Lion 10.8 Developer Preview
- A walk down memory lane
- What is the real meaning of Facebook “Like”?
- Wish you and your family a very Happy and Prosperous New Year 2012!
- Import Orkut’s albums to Google+
Tags
android
apple
c and cpp
Cheats
download
downloads
Entertainment
Film
friendship
Fun
gadgets
Games
gmail
google
greetings
india
Internet
ipad
iphone
java script
linux
love
mac
microsoft
mobile
News
office
Personal
photos
Programming
review
Security
software
source code
technology
Tips & Tricks
video
videos
virus
web
web development
windows
windows 7
worm
yahoo
Recent Comments
- Vikesh Kumar on C++ Program for QUICK SORT
- pratikchavan on C++ Program for QUICK SORT
- suraj on C++ Program Program for Binary Search.
- saravanan on Enabling REGEDIT and Task Manager
- VP on I Got My GirlFriend

An article by
Its really helpful for me……….Thank u.
thankx for code…..short n very useful
Thanks a lot… saved lot of my efforts