note 125721 added to ziparchive.extractto
| From: | cucurella at gmail dot com | Date: | Mon, 25 Jan 2021 10:50:12 +0000 |
| Subject: | note 125721 added to ziparchive.extractto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216228@lists.php.net to get a copy of this message | ||
// Handling ERROR file by file !!
<?php
$ERROR_UNZIP = false;
$dest = "../";
$zipfile = "test.zip";
$zip = new ZipArchive;
if ($zip->open("$zipfile") === true) {
for ($i = 0; $i < $zip -> numFiles; $i++) {
$RETVAL = false;
$filename = $zip->getNameIndex($i);
$RETVAL = $zip->extractTo($dest,$filename);
if ($RETVAL) {
print "$filename ... [ OK ]<br>";
} else {
print "$filename ... [ ERROR ]<br>";
$ERROR_UNZIP = true;
}
}
// close
$zip -> close();
// retval
if ($ERROR_UNZIP) {
print "<p>ERROR unziping ${zipfile}</p>";
} else {
print "<p>Unzip OK</p>";
}
} else {
print "<p>ERROR opening ${zipfile}</p>";
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.166 (proxied: 79.151.211.17)
----
Manual Page -- http://php.net/manual/en/ziparchive.extractto.php
Edit -- https://master.php.net/note/edit/125721
Del: integrated -- https://master.php.net/note/delete/125721/integrated
Del: useless -- https://master.php.net/note/delete/125721/useless
Del: bad code -- https://master.php.net/note/delete/125721/bad+code
Del: spam -- https://master.php.net/note/delete/125721/spam
Del: non-english -- https://master.php.net/note/delete/125721/non-english
Del: in docs -- https://master.php.net/note/delete/125721/in+docs
Del: other reasons-- https://master.php.net/note/delete/125721
Reject -- https://master.php.net/note/reject/125721
Search -- https://master.php.net/manage/user-notes.php