16.2.10

validation in input upload

script type="text/javascript"
function Checkfiles(f){
f = f.elements;
if(/.*\.(gif)|(jpeg)|(jpg)|(doc)$/.test(f['filename'].value.toLowerCase()))
return true;
alert('Please Upload Gif or Jpg Images, or Doc Files Only.');
f['filename'].focus();
return false;
};

form action="#" onsubmit="return Checkfiles(this);"
input type="file" name="filename"
input type="submit" value="Go!"

http://www.dynamicdrive.com/forums/archive/index.php/t-37439.html

No comments: