Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry, wwwxxx jeffs, Catastrophic failure Unexpected method call sequence. 0x8000ffff (-2147418113)., ksh lock a file, [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_DBC failed, sed: -e expression #1, char 1: unterminated address regex, procmail + change subject, w2ksp4.exe download

Links

XODOX
Impressum

#1: open .zip from memory...

Posted on 2010-10-04 14:39:28 by Steven Staples

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.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#2: Re: open .zip from memory...

Posted on 2010-10-04 19:12:29 by List Manager

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#3: Re: open .zip from memory...

Posted on 2010-10-04 20:35:55 by Steven Staples

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



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message