I’m trying to make a page where I can share pictures. For the time being, I’m not using a database, just uploading them into my htdocs. All of my pictures will be PNG, and saved in a folder called
myimages. I want a page to list all of these images, if it’s possible.
Thanks for the help!
If you want to list all files in a directory, you can use
$dir = '/your/folder'; $files1 = scandir($dir); //returns an array of file names (strings)
However, if you need to restrict your search to only PNG files, use
*.png matches against all file names that end with “.png”, and adding the path before that ensures we only get results from inside the specified folder.