同时上传100个文件上传的程序
|
|
|
作者:佚名
来源:InterNet 加入时间:2005-3-23 |
fileup.pl <html> <head> <title></title> <style> .lbtn {font-family:verdana;font-size:10.5pt;} .ist {font-family:verdana;font-size:14.8px;size:400} </style>
<script LANGUAGE="javascript"> function check(){ document.frm1.submit(); document.body.innerHTML="Uploading Please wait!"; }
var i=0; function create(){ var sfrm = document.frm1.innerHTML; var icnt = cnt.value; for(j=0;j<icnt;j++) { sfrm = sfrm + "请选择文件 "+i+" <input type=file name='file"+i+"' class=ist>"; sfrm = sfrm + " 路径:<input type=text name='path"+i+"' value='tmp/' class=ist>"; sfrm = sfrm + "<br>"; i++; } document.frm1.innerHTML = sfrm; document.frm1.cnt.value=i; }
</script>
</head> <body class=lbtn onload="document.frm1.cnt.value=cnt.value;"> 请输入要上传文件的数量: <input type=text name=cnt value="10" class=ist onchange="document.frm1.cnt.value=this.value;"> <input type=button name=bt1 value="生成上传文件框" onclick="create();" class=lbtn> <input type=button name=bt1 value="上传" onclick="check();" class=lbtn> <input type=button name=bt1 value="清除" onclick="document.location.reload();" class=lbtn>
<form name=frm1 method="post" Enctype="multipart/form-data" action="fileup.php"> <input type=hidden name=cnt value="20" class=ist> </form>
<input type=button name=bt1 value="上传" onclick="check();" class=lbtn> <input type=button name=bt1 value="清除" onclick="document.location.reload();" class=lbtn> </body> </html>
fileup.php <? function fup($filename,$fname) { If($filename != "none") { copy($filename,$fname); unlink($filename); } }
for($i=0;$i<$cnt;$i++) { $ffnn="file".$i; $ffnnname=$ffnn."_name"; $ffpath="path".$i;
//print $$ffnn; print $$ffnnname; print "<br>";
fup($$ffnn,$$ffpath.$$ffnnname); //"tmp/" } ?>
fileup.plphpfileup.htm <html> <head> <title></title> <style> .lbtn {font-family:verdana;font-size:10.5pt;} .ist {font-family:verdana;font-size:14.8px;size:400} </style>
<script LANGUAGE="javascript"> function check(){ document.frm1.submit(); document.body.innerHTML="Uploading Please wait!"; }
var i=0; function create(){ var sfrm = document.frm1.innerHTML; var icnt = cnt.value; for(j=0;j<icnt;j++) { sfrm = sfrm + "请选择文件 "+i+" <input type=file name='file"+i+"' class=ist>"; sfrm = sfrm + " 路径:<input type=text name='path"+i+"' value='tmp/' class=ist>"; sfrm = sfrm + "<br>"; i++; } document.frm1.innerHTML = sfrm; document.frm1.cnt.value=i; }
</script>
</head> <body class=lbtn onload="document.frm1.cnt.value=cnt.value;"> 请输入要上传文件的数量: <input type=text name=cnt value="10" class=ist onchange="document.frm1.cnt.value=this.value;"> <input type=button name=bt1 value="生成上传文件框" onclick="create();" class=lbtn> <input type=button name=bt1 value="上传" onclick="check();" class=lbtn> <input type=button name=bt1 value="清除" onclick="document.location.reload();" class=lbtn>
<form name=frm1 method="post" Enctype="multipart/form-data" action="../../cgi-bin/fileup.php"> <input type=hidden name=cnt value="20" class=ist> </form>
<input type=button name=bt1 value="上传" onclick="check();" class=lbtn> <input type=button name=bt1 value="清除" onclick="document.location.reload();" class=lbtn> </body> </html>
[文章录入员:nancy] |
|
|
|
|