Renaming archive entries doesnt work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am trying to add a prefix to all of the entries in a zip file using
the ZipArchive::renameIndex function which is corrupting the files
when I try to extract them. I was wondering if anyone else has used
this method successfully? Here is the code im using:

$client='TEST';
$zip = new ZipArchive();
if ($zip->open($targetpath,ZIPARCHIVE::OVERWRITE)===true)
{
    // prefix all of the files with the clients name
    for($i = 0; $i < $zip->numFiles; $i++)
    {
        $zip->renameIndex($i,$client.$zip->getNameIndex($i));
    }
    if (!$zip->close()) echo 'Failed to rename zip';
}else echo'Failed to open zip';

This renames the files inside the zip but when I try and extract them
the zip is corrupt.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux