Professional Web Applications Themes

Unzip a file. - PHP Development

Hello, Is there an easy way to unzip a zipped file which contains files (images), using a function from the zlib or any. To something like that: exec("unzip zipfile.zip -d /path/to/images") ; But without using the exec function. Thanks, Vincent....

  1. #1

    Default Unzip a file.

    Hello,

    Is there an easy way to unzip a zipped file which contains files
    (images), using a function from the zlib or any.
    To something like that:

    exec("unzip zipfile.zip -d /path/to/images") ;

    But without using the exec function.

    Thanks,
    Vincent.
    Vincent Guest

  2. #2

    Default Re: [PHP] Unzip a file.

    Vincent M. wrote:
     

    You may want to check here....

    http://www.php.net/manual/en/ref.zip.php

    The functions are read only. I don't know if this will do it, but it
    seems that if you can /read/ an entry in the zip file, you should be
    able to write it somewhere.

    However, if you just want to execute the command line app on the OS and
    not use exec(), just enclose your statement in backticks....

    `unzip zipfile.zip -d /path/to/images`;

    --
    By-Tor.com
    It's all about the Rush
    http://www.by-tor.com
    John Guest

  3. #3

    Default Re: [PHP] Unzip a file.

    on phpclasses.org there is a ZIP class that does all you need to do.
    Havnt got the time to give you the url right now, but look there.

    --
    Kim Steinhaug
    ---------------------------------------------------------------
    There are 10 types of people when it comes to binary numbers:
    those who understand them, and those who don't.
    ---------------------------------------------------------------


    "John Nichel" <com> wrote in message
    news:com... 
    >
    > You may want to check here....
    >
    > http://www.php.net/manual/en/ref.zip.php
    >
    > The functions are read only. I don't know if this will do it, but it
    > seems that if you can /read/ an entry in the zip file, you should be
    > able to write it somewhere.
    >
    > However, if you just want to execute the command line app on the OS and
    > not use exec(), just enclose your statement in backticks....
    >
    > `unzip zipfile.zip -d /path/to/images`;
    >
    > --
    > By-Tor.com
    > It's all about the Rush
    > http://www.by-tor.com[/ref]
    Kim Guest

  4. #4

    Default Moving to php

    I'm seriously considering moving to php from a competing 3rd party
    application. I have a few basic questions.

    1. What is the predominate OS platform php runs on? Recommended?

    2. I'm currently well versed in Win 2000 & OS X. Are both "Well" supported?

    3. When php comes out with a new major version (i.e. php 4 -> 5), how
    backward compatible is it? Basically, will I need to do a lot of recoding
    each time there is a new version in order to upgrade? (This is the biggy.)

    4. We are currently standardized on MySQL. I'm assuming MySQL is the
    database of choice or am I wrong?

    --
    Jim
    Jim Guest

  5. #5

    Default Re: [PHP] Moving to php

    hi there,

    I suppose that technically PHP is built to run on Linux, but does work
    on many other platforms. I do all of my development on OS X and have
    never had any problems, I've also had it running on Linux and FreeBSD
    without any trouble. I think there is no problem with Win2000, but I
    don't use that, so I can't give you a definitive answer there.

    From what I've read about the move from 4 to 5 backwards compatibility
    will not be a problem.

    MySQL works fine with PHP, as does PostgreSQL, and loads of other
    databases.

    cheers,

    Gareth


    On 16 Nov 2003, at 14:21, Jim Van Heule wrote:
     
    Gareth Guest

  6. #6

    Default Re: Moving to php

    PHP is 99% (if not 100%) backwards compitable... PHP is even stable on
    WinME, and on XP.. Lots of ppl use it on 2k as well... Works fine.. And fast
    (well, depending on your installation and configuration)... Oh, and about
    support.. PHP on windows accutually have it's own official list/newsgroup
    (php-win or php.windows).. :)

    MySQL and PHP is very good friends.. :)

    --
    // DvDmanDT
    MSN: dvdmandt士otmail.com
    Mail: dvdmandt川elia.com
    ##########################
    Please, if you are using windows, you may be infected by Swen. Please go
    here to find out more:
    http://us.mcafee.com/virusInfo/default.asp?id=helpCenter&hcName=swen
    http://securityresponse.symantec.com/avcenter/venc/data/html
    ##########################
    "Jim Van Heule" <com> skrev i meddelandet
    news:BBDCE415.422F%com... 
    supported? 
    Dvdmandt Guest

  7. #7

    Default Re: [PHP] Re: Moving to php

    Well, yes.. But chanses aren't all that big you'll find any bugs (at least
    not windows specific), unless you try the w32api extension or bcompiler
    combined with zend optimizer...

    --
    // DvDmanDT
    MSN: dvdmandt士otmail.com
    Mail: dvdmandt川elia.com
    ##########################
    Please, if you are using windows, you may be infected by Swen. Please go
    here to find out more:
    http://us.mcafee.com/virusInfo/default.asp?id=helpCenter&hcName=swen
    http://securityresponse.symantec.com/avcenter/venc/data/html
    ##########################
    "Derek Ford" <com> skrev i meddelandet
    news:com... [/ref]
    fast 
    > PHP on windows platforms isn't as good as it 'could be'. A lot of the
    > windows oriented bugs go unfixed, because most core hackers don't care.
    > The major opinion is "why fix bugs on a buggy platform?".[/ref]
    Dvdmandt Guest

  8. #8

    Default Re: [PHP] Re: Moving to php

    Cool.. Weird.. I've used PHP since 4.1.0, on windows ME/Apache 1.3, using
    streams, sockets, w32api, gd, classes, printers and more, never ran into any
    other problems that w32api and bcompiler combined with Zend stuff.. :s

    --
    // DvDmanDT
    MSN: dvdmandt士otmail.com
    Mail: dvdmandt川elia.com
    ##########################
    Please, if you are using windows, you may be infected by Swen. Please go
    here to find out more:
    http://us.mcafee.com/virusInfo/default.asp?id=helpCenter&hcName=swen
    http://securityresponse.symantec.com/avcenter/venc/data/html
    ##########################
    "Derek Ford" <com> skrev i meddelandet
    news:com... [/ref]
    least 
    > I've ran into many. The ones that really take the cake are the streams
    > bugs, which have been around since the inception of socket support.[/ref]


    Dvdmandt Guest

  9. #9

    Default Re: [PHP] Re: Moving to php

    DvDmanDT wrote:
     
    PHP on windows platforms isn't as good as it 'could be'. A lot of the
    windows oriented bugs go unfixed, because most core hackers don't care.
    The major opinion is "why fix bugs on a buggy platform?".
    Derek Guest

  10. #10

    Default Re: [PHP] Re: Moving to php

    DvDmanDT wrote:
     
    I've ran into many. The ones that really take the cake are the streams
    bugs, which have been around since the inception of socket support.
    Derek Guest

  11. #11

    Default Re: [PHP] Moving to php

    > I'm seriously considering moving to php from a competing 3rd party 

    So far the consensus seems to say stay away from Windows, Linux is the main,
    but OS X is working fine.
     

    Consensus here seems to indicate major upgrades do not equal major headaches
    upgrading.
     

    Consensus again seems to indicate this or even many other databases is no
    problem.

    Well, it looks like you may have a new convert on your hands. If not an
    instant convert, at least someone who intends to give php some serious time
    in the coming weeks and months. ;-)

    Thanks

    --
    Jim
    Jim Guest

  12. #12

    Default Re: [PHP] Unzip a file.

    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) org * society and not sufficient moral courage.
    (work) org -- Mary Baker Eddy, "Science and Health"
    http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.0.7 (FreeBSD)

    iD8DBQE/uD2fGb7uCXufRwARAmetAKCKWa8aODIJmsreRq/Ef631u0l+/QCbBqYk
    x617jD50xqNYPGnHg0RxDzc=
    =/HaT
    -----END PGP SIGNATURE-----

    David Guest

  13. #13

    Default Re: [PHP] Unzip a file.

    Kim Steinhaug wrote: 
    All I found are classes to extract tar/gzip files:
    http://www.phpclasses.org/search.html?words=zip&go_search=1&restrict=&method =and&sort=score

    Is there any I couldn't see ?

    Thanks,
    Vincent.
    Vincent Guest

  14. #14

    Default Re: [PHP] Unzip a file.

    For anyone playing around with zip files on a web application i hope you
    have updated your zip libraries there were some vulnerabilities in it
    recently.

    Vincent M. wrote:
     
    > All I found are classes to extract tar/gzip files:
    > http://www.phpclasses.org/search.html?words=zip&go_search=1&restrict=&method =and&sort=score
    >
    >
    > Is there any I couldn't see ?
    >
    > Thanks,
    > Vincent.
    >[/ref]


    --
    Raditha Dissanayake.
    ------------------------------------------------------------------------
    http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
    Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
    Graphical User Inteface. Just 150 KB | with progress bar.
    Raditha Guest

  15. #15

    Default Re: [PHP] Unzip a file.

    tip, search php.net for zziplib

    there are very useful hints and functions from other users......
    i found there everything i needed,.... but a class is somewhat
    better....sure.

    regards,
    volker

    Raditha Dissanayake wrote:
     
    >> All I found are classes to extract tar/gzip files:
    >> http://www.phpclasses.org/search.html?words=zip&go_search=1&restrict=&method =and&sort=score
    >>
    >>
    >> Is there any I couldn't see ?
    >>
    >> Thanks,
    >> Vincent.
    >>[/ref]
    >
    >[/ref]
    Volker Guest

  16. #16

    Default Re: [PHP] Unzip a file.

    Hello!

    This one :
    http://www.phpclasses.org/browse.html/package/870.html

    I remember doing the "zip" research a while ago and tested several classes
    and
    methods, but this class was the one that worked flawlessly! Ive installed
    and
    used this class myself, and it works on both linux and windows.

    This can zip down a directory of 1GB of data (tested), and depack it to
    another
    directory (tested). You can also extract single files out of the directory.

    If you havnt found a sollution you should try this one.

    --
    Kim Steinhaug
    ---------------------------------------------------------------
    There are 10 types of people when it comes to binary numbers:
    those who understand them, and those who don't.
    ---------------------------------------------------------------


    "Vincent M." <fr> wrote in message
    news:pair.com... 
    > All I found are classes to extract tar/gzip files:
    >[/ref]
    http://www.phpclasses.org/search.html?words=zip&go_search=1&restrict=&method =and&sort=score 
    Kim Guest

Similar Threads

  1. how to unzip ?
    By Yang Li Ke in forum PHP Development
    Replies: 1
    Last Post: May 24th, 08:11 PM
  2. Unzip file in RS/6000
    By Rickie in forum AIX
    Replies: 2
    Last Post: October 9th, 10:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139