How to quickly extract a file from a zip archive in PHP

You can use the usual copy function for fast file extraction from a zip archive:

copy("zip://" . $zipFilePath. "#" . $zippedFileName, $unzipFilePath);

where

  • $zipFilePath - archive path
  • $zippedFileName - file name in archive
  • $unzipFilePath - where to extract

Example: 

copy("zip://myfile.zip#textfile.doc", "myDocument.doc");

 

Comments

No comments yet, you can leave yours: