For uploading multiple files, you can use js to dynamically generate file fields. The source code is below. Save it here for direct use in the future, hoho!
JS code:
<script language="javascript">
//Global variable, represents the number of file fields, and uses this variable to distinguish the name attribute of the file field
var file_count = 0;
//Add file field
function additem(id) {
if ( file_count > 9) {
alert("The most u22810 10 u25991 files u22495 ");
return;
}
//Define the row variable row; the cell variable cell; the cell content variable str.
var row,cell,str;
//Insert a row in the table with the specified id
row = eval("document.all["+'"'+id+'"'+"]").insertRow();
if(row ! = null ) {
//Set the background color of the row
row.bgColor="white";
//Insert a cell in the row
cell = row.insertCell();
//Set the value of str, including a file field and a delete button
str='<input onselectstart="return false" class="tf" onpaste="return false" type="file" name="file[' + file_count + ']" style="width:500px" onkeydown="return false;"/>';
str += " <input type="+'"'+"button"+'"'+" value="+'"'+"Delete"+'"'+" onclick ='deleteitem(this,"+'"'+"tb"+'"'+");'>";
//The number of file fields increases
file_count++;
//Set the innerHTML of the cell to the content of str
cell.innerHTML =str;
}
}
//delete file domain
function deleteitem(obj,id) {
var rowNum,curRow;
curRow = obj.parentNode.parentNode;
rowNum = eval("document.all."+id).rows.length - 1;
eval("document.all["+'"'+id+'"'+"]").deleteRow(curRow.rowIndex);
file_count--;
}
</script>
HTML code:
<input type=button value="Add" onclick='additem("tb")'/><br/>
<table cellspacing="0" id="tb" style="width:400px">
</table>