note 71881 rejected from function.scandir by nlopess
| From: | nlopess@php.net | Date: | Fri, 22 Dec 2006 20:19:48 +0000 |
| Subject: | note 71881 rejected from function.scandir by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-120860@lists.php.net to get a copy of this message | ||
Note Submitter: saphir (at) gazmazk dot com
----
hello all,
when i list my directories in html i can click the images
but i can't click the directories, it states i don't have permission, although i chmod my
folders in question to 777 to test.
any info on this please?
changed a bit to the code this doesn't use the javascript go function that was not added.
the code i found here in this topic was :
<?php
function ls_recursive2($dir)
{
if (is_dir($dir))
{
$files = scandir($dir);
foreach ($files as $file)
{
$currentfile = $dir . "/" . $file;
$last_dir = "";
// Calculate they identation.
$count = substr_count($currentfile, '/');
$minus_count = substr_count($_SERVER['DOCUMENT_ROOT'], '/');
$count -= ($minus_count + 2);
for($p = 0; $p < $count; $p++)
{
$last_dir .= " ";
}
if (is_dir($currentfile))
{
if ($file != '.' && $file != '..')
{
$last_dir .= "<img src='images/folder.gif' alt=''
align='middle' width='16' height='16'
border='0'> <a href='$currentfile' \"> ".
substr($currentfile, strrpos($currentfile, '/')) . "</a><br>";
echo $last_dir;
ls_recursive2($currentfile);
}
}
else
{
$last_dir .= "<img src='images/file.gif' alt=''
align='middle' width='16' height='16'
border='0'> <a href='$currentfile' \"> ".
substr($currentfile, strrpos($currentfile, '/')) . "</a><br>";
echo $last_dir;
}
}
}
}
?>
<?php
ls_recursive2(".");
?>