Am Dienstag, den 09.01.2007, 17:21 +0100 schrieb Jochem Maas: > Bernhard Zwischenbrugger wrote: > > I try to unzip openDocument files with pclzip. > > At my laptop this is no big problem, but the target server has "safe > > mode" switched on (no way to change that). > > > > The problem with safe mode and unzipping openDocument ist, that a > > openDocument zip file contains directories. It is not possible to write > > to directory owned by webserver uid (because of safe mode) > > are there no world writable directories available anywhere for you to use? openDocuement looks like: |-- Configurations2 | `-- accelerator | `-- current.xml |-- META-INF | `-- manifest.xml |-- Thumbnails | `-- thumbnail.png |-- content.xml |-- meta.xml |-- mimetype |-- settings.xml `-- styles.xml The directories "Configurations2", "META-INF", "Thumnails" are created and it is not possible for pclzip in safe mode to write to these directories. > > > > > My Project: > > I try to extract the "content.xml" from openDocument, change it and > > store it back to the openDocument (zip) file. > > > > Question: > > Is it possible to extract a single file from a zip file? > > Is it possible to replace a single file in a zip file? > > it kind of depends on your particular setup (server version, access to > PECL, etc): > > there is this (will require some reading to determine if you can > use it in your case): > > http://php.net/zip http://www.php.net/manual/de/function.ziparchive-addfile.php and http://at.php.net/manual/de/function.ziparchive-getfromname.php would be fine. If there is a package for BSD that would be a solution. Recompile PHP is no option. > > and then there is the possibility of using exec() in conjunction with > the cmdline zip utility, e.g.: > > $args = escapeshellarg($theRequiredArgsToZipCmd); > exec("zip -options $args"); Possibility, but not optimum. > other than that all I can thing of is this (it might turn up something usable): > > http://www.google.com/search?q=php+zip+file+class > The only thing I found is pclzip and that makes problems Bernhard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php