I gets zip archive content with ZipArchive class in PHP. I need to display compressed and uncompressed size for each file in it. How to do this?
$zip = new ZipArchive;
$zip->open('download/' . $results[0]['filename']);
$i = 0;
while($name = $zip->getNameIndex($i)) {
$files[] = array(
'filename' => $name,
'compressed_size' => ???,
'uncompressed_size' => ???);
$i++;
}
$zip->close();
If you read the docu https://www.php.net/manual/en/class.ziparchive.php you will find the function statIndex()
(https://www.php.net/manual/en/ziparchive.statindex.php). Use it instead of function getNameIndex()
.