批量上传无效!咋回事?
提交页面如下(该程序无论在IE,或 火狐下均可运行):test1.htm
<form name="form1" method="post" action="i28.php" enctype="multipart/form-data">
<table id="tb1"></table><input type="hidden" name="file" value="0" >
<input id='file' type="file" name="file" onchange=addFj()><input type="submit" name="submit" value="ok" >
</form>
<script language="javascript">
function addFj()
{
var oTb = document.getElementById("tb1");
var oTr = oTb.insertRow(0);
var name = "thefilename"+document.form1.file.value;
document.form1.file.value=parseInt(document.form1.file.value)+1;
oTr.insertCell(0).innerHTML = "<input id='file' name='+file+' type=file onchange=addFj()>"
return false;
}
</script>
接受页面如下:(发现无法接受数据)
i128.php
<?php
print_r($_POST);
?>
以下这段程序,可以正常接受数据,但只在IE下有效,在火狐下无效:能把上边程序与下边程序的优点结合起来就好了!
test2.htm
<script language="JavaScript">
<!--
var nfiles = 1;
function Expand(){nfiles++;
file.insertAdjacentHTML('BeforeEnd','<br><input type="file" name="file[]" size=23 class=fileput>');
self.document.form2.file_num.value=nfiles;
return false; }
//-->
</script>
<form name="form2" method="post" action="i28.php" enctype="multipart/form-data">
<div id=file><input type="file" name="file[]" class=fileput size="23" ></div>
<input type=hidden name='file_num' value=1>
<input type="submit" name="submit2" value="上传" />
</form>