<script type="text/javascript">
function insertRow(){
	var rowIndex1 = document.all("addordel").length;
	if(rowIndex1 >= 5){
		alert('一次最多能上传5个文件');
		return false;
	}
	var obj=document.getElementsByName("addordel")[0].cloneNode(true);
	document.all("change").appendChild(obj);
}
function delRow(){
	var rowIndex = document.all("addordel").length;
	if(rowIndex >= 2){
		event.srcElement.parentNode.removeNode(true);
	}
}
function chkfile(){
	obj = document.getElementsByName('upname[]');
	num = obj.length;
	for(i=0;i<num;i++){
		if(obj[i].value == 0){
			alert('请添加上传文件');
			return false;
		}
	}
}
</script>
<div style=" background-image:url(images/upfile.gif); background-position:left; background-repeat:no-repeat; width: 95%; height:43px;">&nbsp;</div>
<hr style=" width: 95%; border:1px #597ecf solid;"  />
<div style=" width: 95%; height:25px; background-color: #FFFFCC; border: 1px #FFFF66; line-height: 25px; text-align:center; color:#ff0000;">&nbsp;上传文件限制：100M</div>
<form method="post" enctype="multipart/form-data" action="?act=upfile">
<ul id="change">
<li id="addordel"><input id="upname[]" name="upname[]" type="file" style=" width: 200px; background-color:#f0f0f0; " />&nbsp;
<select id="foundtype[]" name="foundtype[]">
<?php
	$typesql = "select genrename from tb_uptype";
	$typearr = $conne->getRowsArray($typesql);
	$conne->close_rst();
	foreach($typearr as $value){
?>
		<option value="<?php echo $value['genrename']; ?>"><?php echo $value['genrename']; ?></option>
<?php
	}
?>
</select>&nbsp;
<select id="ispub[]" name="ispub[]">
	<option value="0" selected="selected">不公开</option>
	<option value="1">公开</option>
</select>&nbsp;
<button onClick="delRow()" style=" border: 1px #CCCCCC solid; background-color:#f0f0f0;">删除</button>&nbsp;<button onClick="insertRow()" style=" border: 1px #cccccc solid; background-color: #f0f0f0;">增加</button>&nbsp;</li>
</ul>
<input id="upbtn" name="upbtn" type="submit" value="上传" onClick="return chkfile()" style=" background-color:#f0f0f0; border: 1px #CCCCCC solid;" />
</form>