This article mainly introduces php multiple file upload download sample, need friends can refer to the following
Code as follows: <html> <head> <meta charset= "Utf-8" > <title>index_ Uploads</title> </head> <body> <form action= "uploads.php" method= "POST" enctype= " Multipart/form-data "> <input type=" file "name=" file["" > & lt;br> <input type= "file" Name= "file[]" > <br>   ; <input type= "file" Name= "file[]" > <br> & nbsp <input type= "File" Name= "file[]" > <br> <input type= "File" Name= "file[]" > <br> <input type= "Submit" value= "Uploads" > </form> </body> </html> index_uploads.php code as follows: PHP echo "<pre> "; Print_r ($_files); echo "</pre>"; $count = count ($_files[' file '] [' name ']); for ($i = 0; $i < $count; $i + +) { $tmpfile = $_files[' file '] [' Tmp_name ' [$i]; $filefix = Array_pop (Explode (".", $_files[' file '] [' name '] [$i]); $dstfile = "uploads/files/". Time (). " _ ". Mt_rand ().". ". $filefix; if (Move_uploaded_file ($tmpfile, $dstfile)) { echo "<script>alert (' succeed! '); window.location.href= ' listdir.php ';</script> '; } else { echo <script>alert (' fail! '); window.location.href= ' index_uploads.php ';</script> '; } { uploads.php code: <?php H Eader ("content-type:text/html;charset=utf-8 "); $dirname = "Uploads/files"; function Listdir ($dirname) { $ds = Opendir ($dirname); &NBSP ; while ($file = Readdir ($ds)) { $path = $dirname. ' /'. $file; if ($file!= '. ' && $file!= ' ... ') { if (Is_dir ($path)) { & nbsp Listdir ($path); } else { & nbsp echo "<tr>"; echo "<td><img src= ' $path ' ></td>"; echo "<td><a href= ' download.php?imgfile= $f Ile ' >Download</a></td> '; echo "</tr>"; } } echo "<h2> picture download |<a href= ' index_uploads.php ' > image upload </a></ H2> "; echo "<table width= ' 700px ' border= ' 1px ' >"; Listdir ($dirname); echo "</table>"; listdir.php code is as follows: <?php $imgfile = $_get[' Imgfile ']; $path = './uploads/files/'. $imgfile; $imgsize = FileSize ($path); Header ("Content-type:application/octet-stream"); Header ("content-disposition:attachment;filename={$imgfile}"); Header ("content-length:{$imgsize}"); ReadFile ($path); download.php download.php core download: Code as follows: Header ("content-type:application/ OcTet-stream "); Header ("content-disposition:attachment;filename={$imgfile}"); Header ("content-length:{$imgsize}"); ReadFile ($path);