git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8306 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
		
			
				
	
	
		
			30 lines
		
	
	
		
			657 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			657 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * Browse the server directory
 | |
|  */
 | |
| $path = $_POST["path"];
 | |
| $result = array();
 | |
| 
 | |
| if(false && !isset($path)) {
 | |
| 	$element = array();
 | |
| 	$element["name"] = "Path should be specified";
 | |
| 	$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);
 | |
| ?>
 |