多档案上传范例

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  dir="ltr">
<head>
    <title>input file upload multiple files</title>
</head>
<body>
<input type="file" multiple="" name="filesToUpload" id="filesToUpload" onchange="makeFileList();">
<p>
    <strong>Files You Selected:</strong>
</p>
<ul id="fileList"><li>No Files Selected</li></ul>
<script type="text/javascript">
    function makeFileList(){
        var input = document.getElementById("filesToUpload");
        var ul = document.getElementById("fileList");
        while (ul.hasChildNodes()){
            ul.removeChild(ul.firstChild);
        }
        for(var i = 0; i < input.files.length; i++){
            var li = document.createElement("li");
            li.innerHTML = input.files[i].name;
            ul.appendChild(li);
        }
        if(!ul.hasChildNodes()){
            var li = document.createElement("li");
            li.innerHTML = "No files selected.";
            ul.appendChild(li);
        }
    }
</script>
</body>
</html>