input file multiple获取文件名(以分号分隔)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<input type="file" id="myFile" multiple="true"/>
<input type="button" value="点击获取文件名" οnclick="gotFileName();" />
</body>
<script type="text/javascript">
function gotFileName(){
var files = document.getElementById("myFile").files;
//console.log(obj.files);
if(!files || files.length == 0){
alert("未选择文件");
return;
}
var fileNameAll = "";
for(var i = 0; i < files.length; i++){
fileNameAll += files[i].name + ";";
}
fileNameAll = fileNameAll.substr(0, fileNameAll.length - 1);
alert(fileNameAll);
}
</script>
</html>
---------------------
作者:nayi_224
来源:CSDN
原文:https://blog.csdn.net/nayi_224/article/details/87978509
版权声明:本文为博主原创文章,转载请附上博文链接!