Home > php教程 > php手册 > 多文件上传的例子

多文件上传的例子

WBOY
Release: 2016-06-13 12:43:45
Original
897 people have browsed it


多文件上传的例子 //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>



\n";

    
   
  

for($i=1;$i{
  $upfile="upfile".strval($i);
  echo "  \n";  
  echo "     \n";
  echo "  \n";  
}
?>
  
   
   
上传的文件
  
   
  
      

        
      

   



//-----------------------------------------------------------------------------------------------------------------------

//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" ;
?>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template