ZipArchive::getStream> <ZipArchive::getFromName
Last updated: Mon, 28 Dec 2009

ZipArchive::getNameIndex

(PHP 5 >= 5.2.0, PECL zip >= 1.5.0)

ZipArchive::getNameIndexReturns the name of an entry using its index

Descrição

string ZipArchive::getNameIndex ( int $index )

Returns the name of an entry using its index.

Parâmetros

index

Index of the entry.

Valor Retornado

Returns the name on success or FALSE on failure.



User Contributed Notes
ZipArchive::getNameIndex
Yeslifer
03-Mar-2009 09:13
I couldn't find any how-to example for getting the filenames, so I made an easy one.

Here's an example how to list all filenames from a zip-archive:

<?php
$zip
= new ZipArchive;
if (
$zip->open('items.zip'))
{
     for(
$i = 0; $i < $zip->numFiles; $i++)
     {  
          echo
'Filename: ' . $zip->getNameIndex($i) . '<br />';
     }
}
else
{
     echo
'Error reading zip-archive!';
}
?>

Hope it helps.

ZipArchive::getStream> <ZipArchive::getFromName
Last updated: Mon, 28 Dec 2009