<script>
function check(str){
var p=//.(jpg|gif|rar)$/i;
if(str.match(p))
alert("ok");
else alert("Sorry!");
}
</script>
<input type="file" id="_file" />
<input type="button" value="Check" onClick="check(_file.value);" />
function check(str){
var p=//.(jpg|gif|rar)$/i;
if(str.match(p))
alert("ok");
else alert("Sorry!");
}
</script>
<input type="file" id="_file" />
<input type="button" value="Check" onClick="check(_file.value);" />