hi
looks like there is no way of doin this via javascript...
but u're able 2 check what was selected & ask 2 select smth that u want...
<html>
<head>
<title>forms</title>
<script>
function checkit(){
var str=document.forms.form1.fill.value
var len=str.length
var pos=str.lastIndexOf('.')+1
var rest=len-pos
var ext=str.substr(pos,rest)
if (ext!='gif' && ext!='jpg')
alert('u shuld select some picture')
}
</script>
</head>
by using the input type=file tag, is impossible to do this.
(the accept=".." parameter not work).
you may use the common dialog in javascript:
function browse_file() {
var cdl = new ActiveXObject"MsComDlg.CommonDialog"
cdl.maxFileSize=256;
cdl.filter="Imagens|*.gif;*.jpg;*.bmp";
cdl.showopen();
alert('Selected file: '+cdl.filename);
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.