I'm trying to display the contents of a folder on my local HDD as links in a web browser. This is how I get the contents of a folder
$dir = scandir($path);
foreach($dir as $token)
{
if(($token != ".") && ($token != ".."))
{
if(is_dir($path.'/'.$token))
{
$folders[] = $token;
}
else
{
$files[] = $token;
}
}
}
foreach($folders as $folder)
{
$newpath = $path.'/'.$folder;
echo "<a href = tema2.php?cale=$newpath> [ $folder ] </a>" . "<br>";
}
foreach($files as $file)
{
$newpath = $path.'/'.$file;
echo "<a href = file:///$newpath> $file </a>" . "<br>";
}
Everything works fine except the links to the files which do nothing when pressed. The links that show up in my web browser are like this : "file:///C:/folder/test.txt". Tried this is Firefox, Chrome and IE.