Re: Unzip a file.
| From: | David T-G | Date: | Mon, 17 Nov 2003 03:16:48 +0000 |
| Subject: | Re: Unzip a file. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169877@lists.php.net to get a copy of this message | ||
Vincent --
..and then Vincent M. said...
%
% Hello,
Hi!
%
% Is there an easy way to unzip a zipped file which contains files
% (images), using a function from the zlib or any.
Absolutely. I love pclzip from phpconcept.net.
% To something like that:
%
% exec("unzip zipfile.zip -d /path/to/images") ;
%
% But without using the exec function.
You mean like
...
foreach ( array_keys($_FILES[uploads][name]) as $k )
{
$zipfile = new PclZip($_FILES[uploads][tmp_name][$k]
$ziplist = $zipfile->listContent() ;
foreach ( array_keys($ziplist) as $z )
{
$zipfile->extractbyindex($z) ;
rename($ziplist[$z][stored_filename],"$file.jpg") ;
} # foreach(ziplist)
} # foreach(uploads)
...
or so? :-)
%
% Thanks,
% Vincent.
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!