Hello all,
I'm learning PHP and have created a script to display the contents of a folder. I want to strip the file extension from the listing but am not having much luck.
an anyone help me out?
This is what I have so far:
<?php
include 'header.php';
//Define directory to display
$url = './upload_text/';
//Define URL
$handle = opendir ($url);
//Loop to display all images
while (false !== ($file = readdir($handle))){
if($file != "." && $file != ".." && $file != basename(__FILE__)){
echo '<a href="./upload_text/'.$file.'">'.$file.'</a><br />';}
}
include 'header.php';
?>
I'm learning PHP and have created a script to display the contents of a folder. I want to strip the file extension from the listing but am not having much luck.
an anyone help me out?
This is what I have so far:
<?php
include 'header.php';
//Define directory to display
$url = './upload_text/';
//Define URL
$handle = opendir ($url);
//Loop to display all images
while (false !== ($file = readdir($handle))){
if($file != "." && $file != ".." && $file != basename(__FILE__)){
echo '<a href="./upload_text/'.$file.'">'.$file.'</a><br />';}
}
include 'header.php';
?>