In my parent directory I have an index.php file and I have 15 images in a directory named "images". I want to read the filenames and display the images in the browser. Right now I'm just trying to display the filename in a paragraph tag but nothing is happening. I got this code from the first answer in this thread Getting the names of all files in a directory with PHP
<body>
<?php
$dir = "Challenge8/images";
foreach(glob($dir.'/*.*') as $file) {
echo "<p>filename:" . $file . "</p>";
}
?>
</body>
EDIT: I went to FileZilla and copied the entire path and it worked. Can anyone explain why this made a difference? The end location was still "/Challenge8/images"