2010-12-01 01:54:05 +00:00
|
|
|
<?php
|
2010-12-02 23:06:22 +00:00
|
|
|
/**
|
|
|
|
* Browse the server directory
|
|
|
|
*/
|
2010-12-01 01:54:05 +00:00
|
|
|
$path = $_POST["path"];
|
|
|
|
$result = array();
|
|
|
|
|
|
|
|
if(false && !isset($path)) {
|
|
|
|
$element = array();
|
2010-12-02 23:06:22 +00:00
|
|
|
$element["name"] = "Path should be specified";
|
2010-12-01 01:54:05 +00:00
|
|
|
$element["isFolder"] = false;
|
|
|
|
$element["isError"] = true;
|
|
|
|
$result[$file] = $element;
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
$path = $path.'/';
|
|
|
|
$handle = opendir($path);
|
|
|
|
while (false !== ($file = readdir($handle))) {
|
|
|
|
if ($file != "." && $file != "..") {
|
|
|
|
$element = array();
|
|
|
|
$element["name"] = $file;
|
|
|
|
$element["isFolder"] = is_dir($path.$file);
|
|
|
|
$element["isError"] = false;
|
|
|
|
$result[$file] = $element;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($result);
|
|
|
|
?>
|