I need to check is a file with extension .mp3 is present in a particular directory.
I know how to check when I know the file name but how do you do it when the file name is unknown?
<?php
$filename = '/path/to/foo.mp3';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}