DirectoryLister for Zend

8 views
Skip to first unread message

davinder....@gmail.com

unread,
Oct 30, 2017, 1:26:40 PM10/30/17
to Directory Lister Mailing List
I want to implement DirectoryLister in Zend 1
SO the different thing is, i want to list the folder which i out of webroot, mean i want to list the private folder.

Folder is placed outside of public folder, along with application.

I want to do this by controller. Please let me know if i can do this. I have tried to put index.php code in controller and pt resources folder inside the folder which i want to list but did not worked that.

davinder....@gmail.com

unread,
Oct 30, 2017, 1:53:47 PM10/30/17
to Directory Lister Mailing List

Following php code is working for me(custom directory browser). Please review and let me know if we can implement it in DirectoryLister


"
public function indexAction() {
$root = dirname(APPLICATION_PATH) . '\emailLog';
$path = null;
if (isset($_GET['file'])) {
$path = $_GET['file'];
if (!file_exists($root . '\\' . $path)) {
$path = null;
} else {
$path = '/' . $path;
}
}
if (is_file($root . $path)) {
readfile($root . $path);
}

if ($path)
echo '<a href="?file=' . urlencode(substr(dirname($root . $path), strlen($root) + 1)) . '">..</a><br />';
foreach (glob($root . $path . '/*') as $file) {
$file = realpath($file);
$link = substr($file, strlen($root) + 1);
echo '<a href="?file=' . urlencode($link) . '">' . basename($file) . '</a><br />';
}
exit;
}
"

Reply all
Reply to author
Forward
0 new messages