open .zip from memory...
| From: | Steve Staples | Date: | Mon, 04 Oct 2010 12:39:28 +0000 |
| Subject: | open .zip from memory... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-308432@lists.php.net to get a copy of this message | ||
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.