1<?php 2$header_prefix = 'file'; 3$slots = 6; 4?> 5<html> 6<head> 7<title>Test upload</title> 8</head> 9<body> 10<? 11if ($_POST){ 12 echo "<h2>Uploaded files:</h2>"; 13 echo "<table border=\"2\" cellpadding=\"2\">"; 14 15 echo "<tr><td>Name</td><td>Location</td><td>Content type</td><td>MD5</td><td>Size</tr>"; 16 17 for ($i=1;$i<=$slots;$i++){ 18 $key = $header_prefix.$i; 19 if (array_key_exists($key."_name", $_POST) && array_key_exists($key."_path",$_POST)) { 20 $tmp_name = $_POST[$key."_path"]; 21 $name = $_POST[$key."_name"]; 22 $content_type = $_POST[$key."_content_type"]; 23 $md5 = $_POST[$key."_md5"]; 24 $size = $_POST[$key."_size"]; 25 26 echo "<tr><td>$name</td><td>$tmp_name</td><td>$content_type</td><td>$md5</td><td>$size</td>"; 27 } 28 } 29 30 echo "</table>"; 31 32}else{?> 33<h2>Select files to upload</h2> 34<form name="upload" method="POST" enctype="multipart/form-data" action="/upload"> 35<input type="file" name="file1"><br> 36<input type="file" name="file2"><br> 37<input type="file" name="file3"><br> 38<input type="file" name="file4"><br> 39<input type="file" name="file5"><br> 40<input type="file" name="file6"><br> 41<input type="submit" name="submit" value="Upload"> 42<input type="hidden" name="test" value="value"> 43</form> 44<?} 45?> 46</body> 47</html> 48