//define the path as relative if ($path=="") $path = "."; //using the opendir function $dir_handle = @opendir($path) or die("Unable to open $path"); $i=0; $j=0; //running the while loop while (false !== ($f=readdir($dir_handle))) { if (!ereg('^(\.\.?|index\.php)$',$f)){ if (is_dir($path."/".$f)) $dir[$i++] = $f; else $file[$j++] = $f; } } //closing the directory closedir($dir_handle); $d_prev = substr( $path, 0, ( strrpos( dirname( $path . "/." ), "/" ) ) ); ?>
Index of print $path; ?>
Name | Size |
print "Parent directory"; ?> | - |
$f/ | "; print "- | "; print "
$f | "; print "$size | "; print "