List Info

Thread: note 66897 added to ref.zip




note 66897 added to ref.zip
user name
2006-05-31 17:55:03
I have written a small Class in PHP5 for reading a ZIP-File:
I hope someone could need it. 

<?php
  class zip
  {
   public function readZIPFile($filename)
   {
    // Declair Vars
    $i     = 0;
    $array = array();
    $zip   = zip_open($filename);

    // Read ZIP and write it to an Array    
    if($zip):
     while($entry = zip_read($zip)):
      $array[$i]['name']       = zip_entry_name($entry);
      $array[$i]['size']       =
zip_entry_filesize($entry);
      $array[$i]['compressed'] =
zip_entry_compressedsize($entry);
      $array[$i]['method']     =
zip_entry_compressionmethod($entry);
      if(zip_entry_open($zip, $entry, "r")):
       $array[$i]['content']   = zip_entry_read($entry,
zip_entry_filesize($entry));
       zip_entry_close($entry);
      endif;
      $i++;
     endwhile;
     return $array;
    else:
     trigger_error("Zip-File couldn't be
open!",E_USER_ERROR);
     return false;
    endif;
   }
  }
?>

mfG Xardas
----
Server IP: 217.160.72.57
Probable Submitter: 84.131.217.41
----
X-Spam-Status: No, hits=3.1 required=5.0
tests=DATE_MISSING,FROM_NO_LOWER 
	autolearn=no version=2.64
----
Manual Page -- http://www.p
hp.net/manual/en/ref.zip.php
Edit        -- http://master.p
hp.net/note/edit/66897
Del: integrated  -- ht
tp://master.php.net/note/delete/66897/integrated
Del: useless     -- http:
//master.php.net/note/delete/66897/useless
Del: bad code    -- http
://master.php.net/note/delete/66897/bad+code
Del: spam        -- http://m
aster.php.net/note/delete/66897/spam
Del: non-english -- h
ttp://master.php.net/note/delete/66897/non-english
Del: in docs     -- http:
//master.php.net/note/delete/66897/in+docs
Del: other reasons-- http://master
.php.net/note/delete/66897
Reject      -- http://master
.php.net/note/reject/66897
Search      -- http://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 66897 deleted from ref.zip by bjori
user name
2006-05-31 18:30:28
Note Submitter: Xardas der Dunkle
Reason: bad code

----

I have written a small Class in PHP5 for reading a ZIP-File:
I hope someone could need it. 

<?php
  class zip
  {
   public function readZIPFile($filename)
   {
    // Declair Vars
    $i     = 0;
    $array = array();
    $zip   = zip_open($filename);

    // Read ZIP and write it to an Array    
    if($zip):
     while($entry = zip_read($zip)):
      $array[$i]['name']       = zip_entry_name($entry);
      $array[$i]['size']       =
zip_entry_filesize($entry);
      $array[$i]['compressed'] =
zip_entry_compressedsize($entry);
      $array[$i]['method']     =
zip_entry_compressionmethod($entry);
      if(zip_entry_open($zip, $entry, "r")):
       $array[$i]['content']   = zip_entry_read($entry,
zip_entry_filesize($entry));
       zip_entry_close($entry);
      endif;
      $i++;
     endwhile;
     return $array;
    else:
     trigger_error("Zip-File couldn't be
open!",E_USER_ERROR);
     return false;
    endif;
   }
  }
?>

mfG Xardas

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )