|
Posted by Rob on 01/09/08 09:50
On Jan 8, 8:01 pm, frizzle <phpfriz...@gmail.com> wrote:
> 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
> etc.
>
> 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;
>
> if(is_dir($point)){
> $info[$file] = do_dirs($point, $loop+1);
> };
> }
> }
> return $info;
>
> }
>
> print_r(do_dirs())
>
> *** OUTPUT ***
> Array
> (
> [scripts] => Array
> (
> [javascripts] =>
> )
> [images] => Array
> (
> [photos] => Array
> (
> [black_white] => Array
> (
> [sepia] =>
> )
> [color] =>
> )
> [illustrations] =>
> [renderings] => Array
> (
> [3dmax] =>
> )
> )
> )
For this particular task, I would using this piece of software :-
http://extplorer.sourceforge.net/
I'm sure it will probably do everything you need, including FTP
connections.
Rob.
BTW, I have no affiliation with the author - it's just a good piece of
software
Navigation:
[Reply to this message]
|