hi guys, i have this script to view a readble directory from a php page
// Set the directory name and open it.
$search_dir = 'public_html/images/ads/top/browser_uploaded';
$dp = opendir ($search_dir);
// List the directories first.
while ($item = readdir ($dp) ) {
if ( (is_dir ($item)) AND (substr ($item, 0, 1) != '.') ) {
print "$item<br />\n";
}
}
rewinddir ($dp); // Reset the pointer.
// Create a table header.
print '<hr /><br />
<table cellpadding="2" cellspacing="2" align="left">
<tr>
<td><b>File Name</b></td>
<td><b>File Size</b></td>
<td><b>Last Modified</b></td>
</tr>';
// List the files.
while ($item = readdir ($dp) ) {
if ( (is_file ($item)) AND (substr ($item, 0, 1) != '.') ) {
// Get the file size.
$fs = filesize ($item);
// Get the file's modification date.
$lm = date ('F j, Y', filemtime ($item));
// Print the information.
print "<tr>
<td>$item</td>
<td>$fs bytes</td>
<td>$lm</td>
</tr>\n";
} // Close the IF.
} // Close the WHILE.
print '</table>'; // Close the HTML table.
closedir ($dp); // Close the directory.
but its not completely working. the files are not displayed.
what could be wrong here? please help. thanks in advance. 🆒