다이나믹한 파일업로드 폼
var AtthNum = 0;
function AppendAttachFile() {
var AtthBox = "";
var AtthOk = true;
if(AtthNum >= 10)
return;
if(AtthNum > 0) {
var file;
AtthBox = "document.Attach.A" + (AtthNum - 1);
AtthBox += ".value";
file = eval(AtthBox);
if(file.length <= 0)
AtthOk = false;
}
if(AtthOk) {
var Atth= "document.all.AtthBox" + (AtthNum);
Atth += ".style.display = ";
Atth += "(document.all.AtthBox" + (AtthNum);
Atth += ".style.display == ''none'') ? '''' : ''none''";
eval(Atth);
AtthNum++;
}
}
</script> <form Name="Attach" enctype="multipart/form-data" action="HIServlet" method="post">
<input type="button" value="파일추가" onClick="AppendAttachFile();">
<table border="0" cellspacing ="0" cellpadding ="0" style="width:100%">
<tr>
<td align="left"><input name="A0" type="FILE" style="display:none; width=385px;" id="AtthBox0"></td>
</tr>
<tr>
<td align="left"><input name="A1" type="FILE" style="display:none; width=385px;" id="AtthBox1"></td>
</tr>
<tr>
<td align="left"><input name="A2" type="FILE" style="display:none; width=385px;" id="AtthBox2"></td>
</tr>
<tr>
<td align="left"><input name="A3" type="FILE" style="display:none; width=385px;" id="AtthBox3" ></td>
</tr>
<tr>
<td align="left"><input name="A4" type="FILE" style="display:none; width=385px;" id="AtthBox4"></td>
</tr>
<tr>
<td align="left"><input name="A5" type="FILE" style="display:none; width=385px;" id="AtthBox5"></td>
</tr>
<tr>
<td align="left"><input name="A6" type="FILE" style="display:none; width=385px;" id="AtthBox6"></td>
</tr>
<tr>
<td align="left"><input name="A7" type="FILE" style="display:none; width=385px;" id="AtthBox7"></td>
</tr>
<tr>
<td align="left"><input name="A8" type="FILE" style="display:none; width=385px;" id="AtthBox8"></td>
</tr>
<tr>
<td align="left"><input name="A9" type="FILE" style="display:none; width=385px;" id="AtthBox9"></td>
</tr>
</table>
</form>