note 98949 added to function.zip-entry-filesize

From: Date: Sat, 17 Jul 2010 00:17:34 +0000
Subject: note 98949 added to function.zip-entry-filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-170933@lists.php.net to get a copy of this message
Simple function that return total size of files in archive. May be useful for check for zip bombs. <?php function get_zip_originalsize($filename) { $size = 0; $resource = zip_open($filename); while ($dir_resource = zip_read($resource)) { $size += zip_entry_filesize($dir_resource); } zip_close($resource); return $size; } $size = get_zip_originalsize('file.zip'); echo "original size: $size bytes\n"; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 213.21.35.214 ---- Manual Page -- http://www.php.net/manual/en/function.zip-entry-filesize.php Edit -- https://master.php.net/note/edit/98949 Del: integrated -- https://master.php.net/note/delete/98949/integrated Del: useless -- https://master.php.net/note/delete/98949/useless Del: bad code -- https://master.php.net/note/delete/98949/bad+code Del: spam -- https://master.php.net/note/delete/98949/spam Del: non-english -- https://master.php.net/note/delete/98949/non-english Del: in docs -- https://master.php.net/note/delete/98949/in+docs Del: other reasons-- https://master.php.net/note/delete/98949 Reject -- https://master.php.net/note/reject/98949 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170933) next »