tags:

views:

98

answers:

2

this my code

$z = new ZipArchive();

if ($z->open('file.zip')) {

            for ($i=0; $i<$z->numFiles;$i++) {
                $aZipDtls = $z->statIndex($i);
                echo $aZipDtls['name'].'<br>';

            }
     }

it returns

docs/
docs/INSTALL.html
docs/auth_api.html
docs/install/
docs/install/index.htm

but i want it return a files tree like that

docs/
 -INSTALL.html
 -auth_api.html
  install
   -index.htm

to make it ul and li and i want to do this do use the PHP File Tree

+1  A: 

You'll have to work that out manually. The zip archive stores the files in a very flat structure, but has knowledge of the structure required when "unzipping".

You will have to work out this structure as you go through the archive. You will need to take a look a string functions to help you do this:

http://php.net/manual/en/ref.strings.php

Sohnee
this mean there is no way to so that?
moustafa
you can achieve what you want, you just have to code it yourself as there is no built in function for that.
Jan Hančič
how can i do that
moustafa
A: 

Perhaps you could use this library, I think it supports listing content. http://www.phpconcept.net/pclzip/man/en/index.php

Tim