Re: open .zip from memory...
| From: | Steve Staples | Date: | Mon, 04 Oct 2010 18:35:55 +0000 |
| Subject: | Re: open .zip from memory... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308443@lists.php.net to get a copy of this message | ||
On Mon, 2010-10-04 at 10:12 -0700, Jim Lucas wrote:
> 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
>
Jim:
That is exactly what I was looking for... man, I feel dumb... I was
looking at the tmpfile() and tmpname() but it wasn't quite what i was
looking for. I've use the php://xxx before, but it slipped my mind.
thanks again :) I will implement this tonight :)
Steve