PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

PHP动态多文件上传的具体代码分享_PHP教程

原创
2016-07-15 13:29:18 629浏览

大家在通过对上传文件代码:

  1. nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     
  2. html xmlns="http://www.w3.org/1999/xhtml">     
  3. head>     
  4. meta http-equiv="Content-Type" content="text/html; charset=gb2312" />     
  5. title>文档上传title>     
  6. head>     
  7. body>     
  8. mce:script language="javascript">     
  9.    function AddRow()     
  10.    {     
  11.     var eNewRow = tblData.insertRow();     
  12.     for (var i=0;i1;i++)     
  13.     {     
  14.       var eNewCell = eNewRow.insertCell();     
  15.       eNewCell.innerHTML = "";     
  16.     }     
  17.    }     
  18.          
  19. // -->mce:script>     
  20. form name="myform" method="post" action="uploadfile.php" enctype="multipart/form-data" >     
  21.   table id="tblData" width="400" border="0">     
  22.          
  23.          
  24.          
  25.     input name="postadd" type="hidden" value="php echo "http://".$_SERVER['HTTP_HOST'].$_SERVER["PHP_SELF"]; ?>/>     
  26.     tr>td>文件上传列表          
  27.     input type="button" name="addfile"  onclick="AddRow()" value="添加列表" />td>tr>       
  28.         
  29.    tr>td>input type="file" name="filelist[]" size="50" />td>tr>     
  30.         
  31.  table>     
  32.   input type="submit" name="submitfile" value="提交文件" />     
  33.  form>     
  34. body>     
  35. html>   

PHP动态多文件上传之提交文件代码:

  1. nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    >     
  2. html xmlns="http://www.w3.org/1999/xhtml">     
  3. head>     
  4. meta http-equiv="Content-Type" content="text/html; charset=gb2312" />     
  5. title>文件上传结果title>     
  6. head>     
  7. body>     
  8. php     
  9.     if ($_POST["submitfile"]!="")     
  10.        {               
  11.          $Path="./".date('Ym')."//m.sbmmt.com/m/";     
  12.          if (!is_dir($Path))//创建路径     
  13.              {  mkdir($Path);  }      
  14.          echo "div>";     
  15.          for ($i=0;$icount($filelist);$i++)     
  16.          { //$_FILES["filelist"]["size"][$i]的排列顺序不可以变,
    因为fileist是一个二维数组     
  17.            if ($_FILES["filelist"]["size"][$i]!=0)      
  18.             {     
  19.               $File=$Path.date('Ymdhm')."_".$_FILES["filelist"]["name"][$i];     
  20.               if (move_uploaded_file($_FILES["filelist"]["tmp_name"][$i],$File))     
  21.                  { echo "文件上传成功 文件类型:".$_FILES["filelist"]
    ["type"][$i]." "."文件名:"    
  22.                         .$_FILES["filelist"]["name"][$i]."br>"; }     
  23.               else    
  24.                  { echo "文件名:".$_FILES["filelist"]["name"][$i]."上传失败br>"; }     
  25.             }     
  26.          }     
  27.          echo "div>br>a href="$postadd" mce_href="$postadd">返回a>div>";          
  28.        }     
  29.             
  30.    ?>     
  31. body>     
  32. html>   

以上就是PHP动态多文件上传的所有代码。


www.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...
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。