home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / src / PHP / multiupload.php3.txt < prev    next >
Encoding:
Text File  |  2002-05-06  |  2.0 KB  |  77 lines

  1. Multi Upload 
  2.  
  3. Uploading Multiple files. Display uploaded bytes. 
  4.  
  5.  
  6.  
  7. <?php
  8. /* I had tested it in PHP4b3, Apache under windows 95/98 */
  9. /* MultiUP by npguy, npguy@my-deja.com */
  10.  
  11. /* Destination of Upload files..use / insted of \\ in UNIX */
  12. define("DESTINATION", "c:\\upload\\");
  13.  
  14. /* Number of Upload files */
  15. define("UPLOAD_NO", 10);
  16.  
  17. echo("<p align='center'><b><font size='4'>MultiUP<br> by npguy, npguy@my-deja.com");
  18.  
  19. if($REQUEST_METHOD!="POST")
  20. {
  21.     print "<form enctype=\"multipart/form-data\" method=post>\n";
  22.     print "<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"3000000\">\n";
  23.  
  24.     for($i=1; $i<=UPLOAD_NO; $i++)
  25.     {
  26.         echo "<input type=file name=infile$i>    ";
  27.         
  28.         if($i%2==0)
  29.         print"<br>";
  30.     }
  31.     echo "<br><br><input type=submit value=upload></form>\n";
  32. }
  33. else
  34. {
  35.     /* handle uploads */
  36.     $noinput = true;
  37.     for($i=1; $noinput && ($i<=UPLOAD_NO); $i++)
  38.     {
  39.         if(${"infile".$i}!="none") $noinput=false;
  40.     }
  41.     if($noinput)
  42.     {
  43.         print "<big><B>Error uploading. Try again.</B></big>";
  44.         exit();
  45.     }
  46. echo("<p align='center'><b><font size='4'>Successfully Uploaded<br>");
  47.  
  48. echo("<table border='1' width='84%' height='52' bordercolorlight='#008080' bordercolordark='#008080'>
  49.   <tr>
  50.     <td width='14%' bgcolor='#008000' height='21'><font color='#FFFFFF'><b>Sn</b></font></td>
  51.     <td width='52%' bgcolor='#008000' height='21'><font color='#FFFFFF'><b>Filename</b></font></td>
  52.     <td width='34%' bgcolor='#008000' height='21'><font color='#FFFFFF'><b>Size</b></font></td>
  53.     </tr>");
  54.   
  55.     for($i=1; $i<=UPLOAD_NO; $i++)
  56.     {
  57.         
  58.         $just=filesize(${"infile".$i});
  59.         $fp_size[i] = $just;
  60.         
  61.         if(${"infile".$i}!="none" &&
  62.          copy(${"infile".$i}, DESTINATION.${"infile".$i."_name"}) &&
  63.          unlink(${"infile".$i}))
  64.         {        
  65.         echo("<tr>
  66.             <td width='14%' height='19'>$i</td>
  67.             <td width='52%' height='19'>${"infile".$i."_name"}</td>
  68.             <td width='34%' height='19'>$fp_size[i]</td>    
  69.           </tr>
  70.           ");            
  71.         }
  72.     }
  73.     echo "</table>";
  74. ?>
  75.  
  76.