Hopefully someone can help me with some coding issues that Im having
Back Story
I have a website that has hundreds of thousands of PDFS that are listed and linked on a web server
The layout on the server is /PDFS/1-4/file.pdf etc etc
and on the site its listed <a href="/PDF/1-4/1 ACADEMIC SQ.pdf" target="_blank">1 ACADEMIC SQ</a><br>
Ive been manually changing the file names in the link when a new file is added to the server.
I want to automate the proccess where when a file is added to the "PDF/1-4/" folder itll update the webpage 1-4.html etc with the new links and sorted alphabetically
Im VERY new to PHP and so far the only thing that I have is but its not working
<?php
$dirname = '/var/www/download_folder';
$webdirname = '/download_folder';
$dir = opendir($dirname);
$file_list = '';
while(($file = readdir($dir)) != false) {
if(($file != '.') && ($file != '..')) {
$file_list .= "<a href=\"$webdirname/$file\">$file</a><br/>";
}
}
closedir($dir);
?>
<p>
<?=$file_list?>
</p>
Any guidance would be greatly appreciated