Mutley Posted May 4, 2010 Share Posted May 4, 2010 If I have a folder structure like this: > images -> Folder A --> image1.jpg --> image2.jpg -> Folder B --> image1.jpg --> image2.jpg -> Folder C --> image1.jpg --> image2.jpg I'd like to list each folder in the 'images' directory as text, so: Folder A Folder B Folder C I then, when you click on one of the links for say, Folder B, it displays the images inside, image1.jpg and image2.jpg Can anyone provide some code snippets to get me going? I realize a DB would be better for this but I'd like to try this method for just a small site. Thanks in advance. All the best, Nick. Quote Link to comment https://forums.phpfreaks.com/topic/200727-listing-directories-and-grabbing-files/ Share on other sites More sharing options...
Adam Posted May 4, 2010 Share Posted May 4, 2010 The PHP manual contains some good snippets using the readdir function, use this as a starting point. Then pass the current directory through the URL; take serious notice though this could be a huge hole in security if not done right. Quote Link to comment https://forums.phpfreaks.com/topic/200727-listing-directories-and-grabbing-files/#findComment-1053300 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.