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)