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>

posted @ 2016-03-04 21:37  泥娃拉拉  阅读(15834)  评论(1编辑  收藏  举报