zip_entry_filesize – Retrieve the Actual Size of a Zip Directory Entry (PHP)

The PHP function zip_entry_filesize returns the actual size of a zip archive directory entry, takes a zip_entry resource obtained from zip_read(), and can be used together with zip_entry_name in example code to list file names and their original sizes.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
zip_entry_filesize – Retrieve the Actual Size of a Zip Directory Entry (PHP)

Function Signature int zip_entry_filesize(resource $zip_entry) Description Returns the actual size of the specified directory entry within a zip archive.

Parameter $zip_entry – a directory entry resource returned by zip_read().

Return Value The size (in bytes) of the directory entry.

Example The following PHP script demonstrates opening a zip file, iterating over its entries, and printing each entry’s name and original size using zip_entry_name and zip_entry_filesize:

<?php<br/>$zip = zip_open("test.zip");<br/>if ($zip) {<br/>    while ($zip_entry = zip_read($zip)) {<br/>        echo "<p>";<br/>        echo "Name: " . zip_entry_name($zip_entry) . "<br />";<br/>        echo "Original size: " . zip_entry_filesize($zip_entry) . ";";<br/>        echo "</p>";<br/>    }<br/>    zip_close($zip);<br/>}<br/>?>
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Filesystemfile-size
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.