1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| [root@127 nginx] [root@127 html] 50x.html index.html [root@127 html] [root@127 html] <?php $header_prefix = 'file'; $slots = 6; ?> <html> <head> <title>Test upload</title> </head> <body> <?php if ($_POST){ echo "<h3>Uploaded files:</h3>"; echo "<table border=\"2\" cellpadding=\"2\">"; echo "<tr><td>Name</td><td>Location</td><td>Content type</td><td>MD5</td><td>Size</td><td>Scp Command</td><td>Wget Command</tr>"; for ($i=1;$i<=$slots;$i++){ $key = $header_prefix.$i; if (array_key_exists($key."_name", $_POST) && array_key_exists($key."_path",$_POST)) { $tmp_name = $_POST[$key."_path"]; $name = $_POST[$key."_name"]; $content_type = $_POST[$key."_content_type"]; $md5 = $_POST[$key."_md5"]; $size = $_POST[$key."_size"]; $final_path = "/export/share/upload"; if (copy($tmp_name, "$final_path/$name")) { echo "SUCCESS!"; } else { echo "FAIL!"; } $scp_cmd = "scp team@***:/export/share/upload/$name ."; $wget_cmd = "wget http://***/files/upload/$name"; echo "<tr><td>$name</td><td>$final_path</td><td>$content_type</td><td>$md5</td><td>$size</td><td>$scp_cmd</td><td>$wget_cmd</td>"; } } echo "</table>"; }else{?> <h3>Select files to upload</h3> <form name="upload" method="POST" enctype="multipart/form-data" action="/upload"> <input type="file" name="file1"><br> <input type="file" name="file2"><br> <input type="file" name="file3"><br> <input type="file" name="file4"><br> <input type="file" name="file5"><br> <input type="file" name="file6"><br> <input type="submit" name="submit" value="Upload"> <input type="hidden" name="test" value="value"> </form> <?php } ?> </body> </html>
|