Dirlisting & filemanaging

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi there,

I'm buidling a php-app for online (ftp-based) file management. So far,
so good.
Now i've come to a point where i need to be able to copy / move
folders and files.
I have a function (below this post) that gives me an array of the
directory structure, luke the one below the message.

To jump to the problem:
I'd like to display the folders in a dropdown. What i'd like is to
have the following structure:
- scripts
- scripts / javascripts
- photos
- photos / black_white
- photos / black_white / sepia
- photos / illustrations

I'd like to convert the array below the message into the one above,
where each new line is a new array key.

After that, i need to be sure people don't move/copy folders to the
same folder in a higher level like copying "photos" to "photos /
black_white". How do i make sure current and all deeper levels are
disabled / removed from the list.

Thanks a lot!!

****** FUNCTION BELOW ******
function do_dirs($dir = '.', $loop = 0)

  $handle = @opendir($dir);

  while(($file=readdir($handle)) !== false ){

    if($file != '.' && $file != '..'){

      $point = $dir."/".$file;

            $info[$file] = do_dirs($point, $loop+1);
  return $info;


*** OUTPUT ***
  [scripts] => Array
      [javascripts] =>
  [images] => Array
      [photos] => Array
          [black_white] => Array
              [sepia] =>
          [color] =>
      [illustrations] =>
      [renderings] => Array
          [3dmax] =>

Re: Dirlisting & filemanaging

Quoted text here. Click to load it

For this particular task, I would using this piece of software :-


I'm sure it will probably do everything you need, including FTP


BTW, I have no affiliation with the author - it's just a good piece of

Re: Dirlisting & filemanaging

Quoted text here. Click to load it

Thanks Rob for your tip, but i'm actually starting on building quite
the same thing myself, as a part of a bigger CMS.
That's why i was looking for the aforementioned. Nevertheless, i'll
have a look at your option.

Regards, Frizzle.

Site Timeline