php - How to list all files in folders and sub-folders using scandir and display them as an option in select? -
I have a piece of code that I want to list all the files in folders and sub-folders in the current path I would like to modify. I have found many possible solutions I tried to implement them in reality, but nothing seemed to work, so I'm not sure whether they are actually working or it's just wrong Was implemented in Either way this is my current code: & lt ;? Php $ currentdir = 'C: / xampp / htdocs / test /'; // Change to your directory $ dir = opendir ($ currentdir); Echo '& lt; Select Name = "Exercise" & gt; '; $ File = preg_grep ('/^([^.])/', Scandinum ($ dir)); While ($ file = readdir ($ dir)) {if ($ file! = "." & Amp; $ file! = "..") {echo " This code currently shows the result: $ currentdir option 1 Option 2 Option 3 subfolder 1 subfolder 2 / Someone helps me and to write something like this in order to display files from folders and other sub-folders using the current one to show ...