Re: unzip openDocument in safe mode

From: Date: Tue, 09 Jan 2007 16:21:51 +0000
Subject: Re: unzip openDocument in safe mode
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-246790@lists.php.net to get a copy of this message
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? > > 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 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"); here is a webpage version of the zip man page (in case you dont have shell access): http://www.die.net/doc/linux/man/man1/zip.1.html 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 > > I need something like: > > $contentString=extractFromZip("xy.zip","content.xml") > ... $contentString will be changed ... > replaceFileInZip("xy.zip","content.xml",$contentString); > > > thanks > > Bernhard >

« previous php.general (#246790) next »