为方便自己,特整理PHP代码

 
  
  1. <html>  
  2. <head><title>upload picture more once</title></head>  
  3. <body>  
  4.  <form action="" method="post" enctype="multipart/form-data">  
  5.   <p>Pictures:<br />  
  6.   <input type="file" name="pictures[]" /><br />  
  7.   <input type="file" name="pictures[]" /><br />  
  8.   <input type="file" name="pictures[]" /><br />  
  9.   <input type="submit" name="upload" value="Send" />  
  10.   </p>  
  11.  </form>  
  12. </body>  
  13. </html>  
  14.   
  15. <?php  
  16. if($_POST['upload']=='Send'){   
  17.     $dest_folder   =  "picture/";   
  18.  if(!is_dir($dest_folder)){   
  19.         mkdir($dest_folder);   
  20.  }   
  21.  foreach ($_FILES["pictures"]["error"as $key => $error) {   
  22.      if ($error == 0) {   
  23.         $tmp_name = $_FILES["pictures"]["tmp_name"][$key];   
  24.         $name    = $_FILES["pictures"]["name"][$key];   
  25.         $uploadfile = $dest_folder.$name;   
  26.         move_uploaded_file($tmp_name$uploadfile);   
  27.      }   
  28.  }   
  29. }   
  30. ?>