Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to unzip a file using PHP?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 313
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to unzip a file using PHP ?

    Basically zip_open() function is used for opening the unzip file for reading. This is very simple method to unzip a zip file. So we can say that  zip_open() function opens a zip archive for reading.

    The zip_open() function return a open file when it goes for SUCCESS and return FALSE when it goes for failure.

     Syntax of  zip_open() function

    zip_open(filename)

    filename is a required parameter

     Suppose you have a zip file name is file.zip and you want to open in PHP function so you can use below code

    <?php 
         // here call your file path.
        $zipfile = zip_open("/var/www/html/test/file.zip"); 
        //call while loop
        while($Filedata = zip_read($zipfile)) 
        { 
        echo "Filename: " . zip_entry_name($Filedata) . "<br>"; 
        } 
    
     ?> 

    Hope this blog is helpful for you.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: