PHP zip_entry_filesize() Function

❮ PHP Zip Reference

Example

Open a ZIP file archive and get the name and file size of the directory entries:

<?php
$zip = zip_open("test.zip");

if ($zip) {
  while ($zip_entry = zip_read($zip)) {
    echo "<p>";
    // Get name of directory entry
    echo "Name: " . zip_entry_name($zip_entry) . "<br>";
    // Get filesize of directory entry
    echo "Filesize: " . zip_entry_filesize($zip_entry);
    echo "</p>";
  }
  zip_close($zip);
}
?>

The output of the code depends on the contents of the ZIP archive:

Name: ziptest.txt
Filesize: 59

Name: htmlziptest.html
Filesize: 124


Definition and Usage

The zip_entry_filesize() function returns the actual file size of a ZIP directory entry.

Syntax

zip_entry_filesize(zip_entry)

Parameter Values

Parameter Description
zip_entry Required. Specifies the ZIP directory entry returned by zip_read()

Technical Details

Return Value: The size of the directory entry
PHP Version: 4.1.0+

❮ PHP Zip Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.