时间:2021-07-01 10:21:17 帮助过:4人阅读
- >
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>文档上传title>
- head>
- <body>
- <mce:script language="javascript">
- function AddRow()
- {
- var eNewRow = tblData.insertRow();
- for (var i=0;i<1;i++)
- {
- var eNewCell = eNewRow.insertCell();
- eNewCell.innerHTML = "
"; - }
- }
- // -->mce:script>
- <form name="myform" method="post" action="uploadfile.php" enctype="multipart/form-data" >
- <table id="tblData" width="400" border="0">
- <input name="postadd" type="hidden" value="php echo "http://".$_SERVER['HTTP_HOST'].$_SERVER["PHP_SELF"]; ?>" />
- <tr><td>文件上传列表
- <input type="button" name="addfile" onclick="AddRow()" value="添加列表" />td>tr>
- <tr><td><input type="file" name="filelist[]" size="50" />td>tr>
- table>
- <input type="submit" name="submitfile" value="提交文件" />
- form>
- body>
- html>
PHP动态多文件上传之提交文件代码:
- >
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>文件上传结果title>
- head>
- <body>
- php
- if ($_POST["submitfile"]!="")
- {
- $Path="./".date('Ym')."/";
- if (!is_dir($Path))//创建路径
- { mkdir($Path); }
- echo "<div>";
- for ($i=0;$i<count($filelist);$i++)
- { //$_FILES["filelist"]["size"][$i]的排列顺序不可以变,
因为fileist是一个二维数组- if ($_FILES["filelist"]["size"][$i]!=0)
- {
- $File=$Path.date('Ymdhm')."_".$_FILES["filelist"]["name"][$i];
- if (move_uploaded_file($_FILES["filelist"]["tmp_name"][$i],$File))
- { echo "文件上传成功 文件类型:".$_FILES["filelist"]
["type"][$i]." "."文件名:"- .$_FILES["filelist"]["name"][$i]."<br>"; }
- else
- { echo "文件名:".$_FILES["filelist"]["name"][$i]."上传失败br>"; }
- }
- }
- echo "div><br><a href="$postadd" mce_href="$postadd">返回a>div>";
- }
- ?>
- body>
- html>
以上就是PHP动态多文件上传的所有代码。
http://www.bkjia.com/PHPjc/446393.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/446393.htmlTechArticle大家在通过对 上传文件代码: !DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" html xmlns = "http://www.w...