";<br> print_r($_FILES);<br> echo "";
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 ;
echo "<script>alert('succeed!');window.location.href='listdir.php';</script>";
} else {
echo "<script>alert('fail!');window.location.href='index_uploads.php';</script>";
}
}
function listdir($dirname) {
$ds = opendir($dirname);
while ($file = readdir($ds)) {
$path = $dirname.'/'.$file;
if ($file != '.' && $file != '..'){
if (is_dir($path)) {
listdir($path);
} else {
echo "
listdir.php
header("content-type:application/octet-stream");
header("content-disposition:attachment;filename={$imgfile}");
header("content-length:{$imgsize}");
readfile($path);
download.php
download.php
核心下ダウンロード: