How do one strip the file extention eg: .jpg .gif .mp3 and so one from displaying when you link to it??
so instead of showing
file1.jpg
file2.jpg
it shows
file1
file2
so instead of showing
file1.jpg
file2.jpg
it shows
file1
file2
Code:
<? if (!isset($page)) {$page = 0;} $total = 0; if(!($dp = opendir("./"))) die ("Cannot open ./"); $file_array = array(); while ($file = readdir ($dp)) { if(substr($file,0,1) != '.' and $file != "index.php") { $file_array[] = $file; } } $file_count = count ($file_array); sort ($file_array); ?> <p align="left" mode="nowrap"> <? if ($file_count > 0) { $first_record = $page * $conf["items_per_page"]; $last_record = $first_record + $conf["items_per_page"]; while (list($fileIndexValue, $file_name) = each ($file_array)) { if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record)) { echo "<a href=\"$file_name\">$file_name</a> (". round(filesize($file_name)/1024,1) . "kb) "; $total = $total + filesize($file_name); } }
Comment