Hello. I found a template with a php script that reads the files folder in the root of the site.
The site is on my path /var/www/web/ , that is, the script reads only the folder /var/www/web/files . How to rewrite the path in the script so that it can scan files from the /Z/FTP/ folder?
Here is the script itself and where did I get the template from if anyone is interested in http://tutorialzine.com/2014/09/cute-file-browser-jquery-ajax-php/
<?php $dir = "files"; // Run the recursive function $response = scan($dir); // This function scans the files folder recursively, and builds a large array function scan($dir){ $files = array(); // Is there actually such a folder/file? if(file_exists($dir)){ foreach(scandir($dir) as $f) { if(!$f || $f[0] == '.') { continue; // Ignore hidden files } if(is_dir($dir . '/' . $f)) { // The path is a folder $files[] = array( "name" => $f, "type" => "folder", "path" => $dir . '/' . $f, "items" => scan($dir . '/' . $f) // Recursively get the contents of the folder ); } else { // It is a file $files[] = array( "name" => $f, "type" => "file", "path" => $dir . '/' . $f, "size" => filesize($dir . '/' . $f) // Gets the size of this file ); } } } return $files; } // Output the directory listing as JSON header('Content-type: application/json'); echo json_encode(array( "name" => "files", "type" => "folder", "path" => $dir, "items" => $response ));