多文件上传的例子
//upload_html.php---------------------------------------------------------------------------------------------
上传文件 <script> <br>function beforesubmit(forma) <br>{ <br> var indexnamea=forma.indexname.value; <br> var upfilea=forma.upfile.value; <br> var k=/ /g; <br> var indexnamea=indexnamea.replace(k,""); <br> var upfilea=upfilea.replace(k,""); <br> if(indexnamea=="" <br> upfilea=="") <br> { <br> alert("目录名称或上传的目录不能为空!"); <br> return false; <br> } <br> return true; <br>} <br></script>
//-----------------------------------------------------------------------------------------------------------------------
//upload.php-------------------------------------------------------------------------------------------------------------
//upload_path:文件要上传到的目录路径
for($i=1;$i{
$upfile="upfile".strval($i);
if(chop($$indexname)!="" and chop($$upfile)!="")
{
$upfilename=($upfile."_name");
$filename=upload_path.$$upfilename;
$copyfile = copy($$upfile,$filename);
if (!$copyfile)
die("文件上传失败!");
$ls_file.=$$upfilename."\n";
$flag=1 ;
}
}
if($flag){
$ls_msg="文件\n".$ls_file."上传成功!";
}
else{
$ls_msg="无文件上传,请重新选择!";
}
echo "\n" ;
echo "\n" ;
echo "\n" ;
echo "\n" ;
echo $ls_msg."\n";
echo "\n" ;
echo "\n" ;
?>