PhpConcept

Developers Tools

  • Increase font size
  • Default font size
  • Decrease font size
Home PclZip User Guide

PclZip User Guide - PclZip::listContent

Print PDF

Method PclZip::listContent

Overview

This method gives back the list and properties of the files and foders of the archive.

Synopsis

PclZip::listContent()

Returned values

0

On error.

an array

An array file porperties. (See "Returned values ")

Description

This method gives the list of the archive content. The result is an array, each entry in the array describes an archived file or a folder.
For the details of the array entry (the file properties) see : "Returned values "

Sample

  include_once('pclzip.lib.php');
  
  
$zip = new PclZip("test.zip");
  
  if ((
$list $zip->listContent()) == 0) {
    die(
"Error : ".$zip->errorInfo(true));
  }
  
  for (
$i=0$i<sizeof($list); $i++) {
    for(
reset($list[$i]); $key key($list[$i]); next($list[$i])) {
      echo 
"File $i / [$key] = ".$list[$i][$key]."
";
    }
    echo 
"";
  }

This sample will give the following result :

 File 0 / [filename] = data/file1.txt
File 0 / [stored_filename] = data/file1.txt
File 0 / [size] = 53
File 0 / [compressed_size] = 36
File 0 / [mtime] = 1010440428
File 0 / [comment] =
File 0 / [folder] = 0
File 0 / [index] = 0
File 0 / [status] = ok

File 1 / [filename] = data/file2.txt
File 1 / [stored_filename] = data/file2.txt
File 1 / [size] = 54
File 1 / [compressed_size] = 53
File 1 / [mtime] = 1011197724
File 1 / [comment] =
File 1 / [folder] = 0
File 1 / [index] = 1
File 1 / [status] = ok

 

[Back to Methods List]

 

Last Updated on Thursday, 17 December 2009 10:45