Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8795879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:29:18+00:00 2026-06-13T23:29:18+00:00

I’m making a PHP script that retrieve user-given zip files, unzip it, and do

  • 0

I’m making a PHP script that retrieve user-given zip files, unzip it, and do some stuff with the files in it, using a ZipArchive object. How can I avoid zip bombs like 42.zip?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:29:19+00:00Added an answer on June 13, 2026 at 11:29 pm

    Check out zip_entry_filesize: http://php.net/manual/en/function.zip-entry-filesize.php

    It should give you the actual size of the uncompressed archive within the .zip file. Here’s an example function provided in a comment on the manual page:

    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";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a PHP script that does some stuff for me, so I
I'm making a PHP image script that will create circles at a given radius.
I am making a PHP script that will download a file given a name
I am making a PHP script check.php that checks if a user is logged
I'm making a jQuery Ajax POST request to a PHP script that returns an
I am new to Object Oriented PHP. Currently I am making a login script
i have a script that calls a php file and gets an JSON object
I'm making a php script that stores 3 arrays: $images , $urls , $titles
I am developing a PHP script that has to make some calls to a
I am making a simple Dynamic Website using PHP, where i allow the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.