Re: open .zip from memory...

From: Date: Mon, 04 Oct 2010 17:12:29 +0000
Subject: Re: open .zip from memory...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-308442@lists.php.net to get a copy of this message
Steve Staples wrote: > Not sure if my subject is misleading or not, but anyway, here it goes... > > I am trying to download a file using file_get_contents($url) which > happens to be a .zip file. > > I have no issues downloading the file, saving it to the harddrive, > opening it, and getting what i need from it... but what I am trying to > do, is not save it to disk, but to just grab the .zip file, and open it > in memory, grab the file i need from it, and then discard the .zip file, > and parse out the file i grabbed (this would prevent having a folder > with R/W access that could possibly be set wrong, or using the /tmp > folder) > > Again, I dont have any issues doing it where i save it first, but when I > try to use the file from memory, i get errors saying that it can't open > the zip file becuase it has no valid resource id#. > > The zip commands i am using, are the php ones zip_open, zip_read, > zip_entry_read, zip_entry_name, zip_entry_filesize and obviously > zip_close. > > Can this be done, or should I just forget it, and use the /tmp dir? > > Steve. > > > > Might see if this page will glean you any information http://us3.php.net/manual/en/wrappers.php.php I think the php://temp or php://memory will work for you instead of a file on the file system. Jim

« previous php.general (#308442) next »