同个页面上传对应多个类型的附件
前台
<script type="text/javascript" >
var tempCon = new Array();
function addFile()
{
var oTb = document.getElementById("myFile");
var oTr = oTb.insertRow(0);
var fjCnt = document.getElementById("fjCnt");
var name = "thefilename" + fjCnt.value;
fjCnt.value=parseInt(fjCnt.value)+1;
oTr.insertCell(0).innerHTML = "<input id='file' name='"+name+"' type=file size='20'> <input type='button' value='取消' onclick='javascript:delObj(this)' class='imgButton'>";
}
function delObj(obj)
{
obj.parentElement.removeNode(true);
}
</script>
<tr>
<td class="td1">
生产
</td>
<td class="td2">
<asp:TextBox ID="producenm" runat="server" TextMode="MultiLine" Rows="3" Width="80%"></asp:TextBox>
</td>
<td class="td2" style="width:350px;">
<DIV style="HEIGHT: auto" class="MNtable">
<TABLE style="WIDTH: 100%" id="myFile">
<TBODY><TR><TD>
<INPUT id="Button2" class="bt" onclick="javascript:addFile()" type="button" />
<INPUT id="fjCnt" class="disNo" type="text" /></TD>
</TR>
<TR>
<TD>
<asp:Label id="saveStatu" runat="server" Text="" ForeColor="#990000"></asp:Label>
</TD></TR></TBODY></TABLE></DIV>
</td>
</tr>
后台
private Boolean SaveImages()
{
///置空fileArr
fileArr.Clear();
saveStatu.Text = "";
///'遍历File表单元素
//如果没有上传图片
/// '状态信息
System.Text.StringBuilder strMsg = new System.Text.StringBuilder();
/// 随机生成的文件名
string strRankName;
/// 图片地址数组
///strMsg.Append("上传的文件分别是:<hr color=red>");
try
{
//Save图片
for (int iFile = 0; iFile < files.Count; iFile++)
{
HttpPostedFile postedFile = files[iFile];
string fileName, fileExtension;
double filesize;
fileName = System.IO.Path.GetFileName(postedFile.FileName);
filesize = Convert.ToDouble(postedFile.ContentLength) / 1024;
if (fileName != "")
{
fileExtension = System.IO.Path.GetExtension(fileName);
if (fileExtension.ToUpper() == ".exe" || f