I try to open a ZIP archive from a variable instead of a file in PHP.
That means there is a file or a MySQL query, I read into a variable $zip_contents or so. This variable should be passed to a method like ZipArchive::open() instead of the filename.
Is this somehow possible or am I on the wrong track?
Kind regards
zoku
Can you afford little patching of an existing class which unzipps a file? For example, there is a simple solution, involving phpMyAdmin distribution, specifically look into the libraries
subdirectory. It contains unzip.lib.php
(GPL). The function ReadFile
can be easily patched to accept a variable because it reads the file in the first lines and then work with this data. So it only needs to be changed for accepting the data directly.
Here is the direct link to the class.