<input type="file" name="file" id="file" class="input_text80"></input>
js:
方法一:字符串截取
var file = $("#file").val();
var fileName = getFileName(file);
function getFileName(o){
var pos=o.lastIndexOf("\");
return o.substring(pos+1);
}
方法二:正则表达式
var file = $("#file").val();
var strFileName=file.replace(/^.+?\([^\]+?)(.[^.\]*?)?$/gi,"$1"); //正则表达式获取文件名,不带后缀
var FileExt=file.replace(/.+./,""); //正则表达式获取后缀