Perhaps there's a better method than the PHP route, I am open to ideas.
The problem: I have a folder structure for each user. This folder may contain files or sub-folders. I am only concerned with the folders which have files. I am able to run a query and get a recursive listing on a multidimensional array (from PHP code posted on the web). The issue is that I get a multidimensional array that when flattened only lists the inner most file name, and I need to store the path and file -or- the path+file in my sql dbase. The idea is to allow the user to view his files and delete them using a web interface.
Here is an example result from the PHP recursive function. Inside a folder named "Jimmy", you find:
Array
(
[0] => info.txt
[1] => log.tmp
[2] => README.md
[css] => Array
(
[0] => style.css
)
[images] => Array
(
[0] => flower.gif
)
[3] => index.php
[testDir] => Array
(
[anotherTestDir] => Array
(
[0] => test2.php
)
)
[5] => listing.txt
[temp] => Array
(
)
)
What I'd wold like to see is this:
/jimmy/info.txt
/jimmy/log.tmp
/jimmy/README.md
/jimmy/css/style.css
/jimmy/images/flower.gif
/jimmy/index.php
/jimmy/testDir/anotherTestDir/test2.php
/jimmy/listing.txt
And then I would need to sort the string and add it to mysql dbase. Any help on how to achieve this effect would be much appreciated. Once I have my flatten array i want to add it in one go to the user's "folder" table.