js获取上传的文件名
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
<script type="text/javascript">
function change() {
var obj = document.getElementById("upload");
var len = obj.files.length;
for (var i = 0; i < len; i++) {
var temp = obj.files[i].name;
console.log(temp);
}
}
</script>
</head>
<body>
<input id="upload" onchange="change();" type="file" value="点击上传图片" multiple="multiple" />
</body>
</html>