When you rename a file in an archive using the function above and the target file name already exists, the function will return FALSE as a result.(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.5.0)
ZipArchive::renameName — Benennt einen durch seinen Namen bestimmten Eintrag um
Benennt einen durch seinen Namen bestimmten Eintrag um.
nameName des umzubenennenden Eintrags.
new_nameNeuer Name.
Beispiel #1 Einen Eintrag umbenennen
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
$zip->renameName('aktueller_name.txt','neuer_name.txt');
$zip->close();
} else {
echo 'Fehler, Code:' . $res;
}
?>When you rename a file in an archive using the function above and the target file name already exists, the function will return FALSE as a result.