不含后缀名:<input name=f1 type=file><input type=button value="test" onclick="alert(f1.value.replace(/(.*\\|\..+)/g,'').length)"><br>
含后缀名:<input name=f2 type=file><input type=button value="test" onclick="alert(f2.value.replace(/.*\\/g,'').length)">