I host my personal weather station information on a website from my Synology NAS. I recently added a weather webcam and want to create a list of daily videos for users to download from a page on my website. The entire website is php-based and I wrote some code that partially does what I want. It creates a list of the daily mp4 files but I want to display them in chronological order by filename and in addition to the mp4 files the webpage shows a "." and a "..". The mp4 files are stored on my NAS in this directory path: video/archive/2022/ and my weather website page that lists the files is at https://novawx.dscloud.me/2022-video-archive.php. Here is the php code.
<?php
$directory = "video/archive/2022/";
if (is_dir($directory)){
if ($opendirectory = opendir($directory)){
while (($file = readdir($opendirectory)) !== false){
echo "<a href='https://novawx.dscloud.me/$directory" . "$file'
target='_blank'>$file</a>"."<br>";
}
closedir($opendirectory);
}
}
?>