基础 - 验证文件类型

<input id="show" type="file" />


window.onload = function () {

var oShow = document.getElementById("show");
oShow.onchange = function () {

var filePath = this.value;
var suxPath = filePath.substr(filePath.lastIndexOf(".")+1).toUpperCase();
console.log(suxPath);
}

}
 
posted @ 2016-08-10 15:08  WeWeZhang  阅读(157)  评论(0编辑  收藏  举报