コード例 #1
0
function showpath($path, $depth = 0, $foldernum = 0)
{
    $arr = scandir($path);
    foreach ($arr as $key => $value) {
        if (substr($value, 0, 1) != ".") {
            if (is_dir($path . '/' . $value) == true) {
                for ($i = 0; $i < $depth; $i++) {
                    echo " &nbsp; ";
                }
                echo "<b>" . $value . "</b><br>";
                showpath($path . '/' . $value, $depth + 1);
            } else {
                for ($i = 0; $i < $depth; $i++) {
                    echo "&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;";
                }
                echo $value . "<br>";
            }
        }
    }
}
コード例 #2
0
<!DOCTYPE html>
<html>
<head>
	<title>ajax_showfile</title>
	<meta charset="utf-8">
	<script type="text/javascript" src="request.js"></script>
	<?php 
include "showdir.php";
print_r(showpath("uploads"));
?>
</head>
<body><ul>
<?php 
$arr = showpath("uploads");
foreach ($arr as $key => $value) {
    echo "<li><span onclick=\"http_zapros('GET','uploads/" . $value . "',obrabotka)\">" . $value . "</span>" . "<a href=\"uploads/" . $value . "\"> скачать</a></li>";
}
?>
</ul>
<form>
	<input type='submit' name="show" value="show">
	<hr>
	<textarea id="otvet" name="filetext" value="place for text" style="width:500px; height:200px;" >
		
	</textarea>
	<hr>
</form>
<form>
	<input type='submit' name="download" value="download">
</form>
</body>