Copy CodeThe code is as follows:
<title>Index_uploads</title>
index_uploads.php
Copy the Code code as follows:
echo "
";
Print_r ($_files);
echo "
";
$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 "";
} else {
echo "";
}
}
uploads.php
Copy the Code code as follows:
Header ("Content-type:text/html;charset=utf-8");
$dirname = "Uploads/files";
function Listdir ($dirname) {
$ds = Opendir ($dirname);
while ($file = Readdir ($ds)) {
$path = $dirname. ' /'. $file;
if ($file! = '. ' && $file! = ' ... ') {
if (Is_dir ($path)) {
Listdir ($path);
} else {
echo "";
echo "";
echo "Download";
echo "";
}
}
}
}
echo "
Image Download | image upload
";
echo "
"; Listdir ($dirname); echo "
";
listdir.php
Copy the Code code as follows:
$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 Downloads:
Copy the Code code as follows:
Header ("Content-type:application/octet-stream");
Header ("content-disposition:attachment;filename={$imgfile}");
Header ("content-length:{$imgsize}");
ReadFile ($path);
http://www.bkjia.com/PHPjc/825275.html www.bkjia.com true http://www.bkjia.com/PHPjc/825275.html techarticle Copy the code code as follows: HTML head meta charset= "utf-8" titleindex_uploads/title/head body form action= "uploads.php" method= "POST" Enctype= "Multipart/form-data" input type= "file ...