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