Display Zipped File Details

Display Zipped File Details


Posted in : PHP Posted on : January 24, 2011 at 6:47 PM Comments : [ 0 ]

This section contains the detail about the displaying Zipped File Details.

Display Zipped File Details

In this section, we will display the zipped files detail such as its name . The zipped files are those files which are stored in the zip folder after compression.

Example

In this example, we are displaying the detail of the zipped file inside the "ZipDirectory.zip". Given below the code :

<?PHP
// object creation
$zip = new ZipArchive(); 

// open zip file 
if ($zip->open('ZippedContent/ZipDirectory.zip') !== TRUE) {
die ("Could not open archive");
}

// Counting number of files in zip
$numFiles = $zip->numFiles;

// iterate over each file in zip & printing its details
for ($x=0; $x<$numFiles; $x++) {
$file = $zip->statIndex($x);
printf("%s (%d bytes)", $file['name'], $file['size']);
print "<br/>"; 
}

// closing archive
$zip->close();
?>

Output :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics