| | |
using perl to display zip file contents
![]() |
•
•
Join Date: May 2005
Posts: 45
Reputation:
Solved Threads: 0
I would like to enable users to view the contents of a zip file via CGI interface. I have tinkered around with Archive::Zip, Archive::Zip::MemberRead, and Archive::Extract, and can't seem to figure out a way to work. After perusing the net for a solution to this, it seems that perhaps the only thing that these do is to either output into another file, directory, or at best, I get a result printed out of "HASH::blah blah blah". If anyone could shed some light as to how to do this, I would sure appreciate it.
Again, to clarify, I would like to actually display the files that are contained within the respective zip file. For example, a zip has "txt1.txt, txt2.txt, txt3.txt", screen would display these filenames to user.
Derek
Again, to clarify, I would like to actually display the files that are contained within the respective zip file. For example, a zip has "txt1.txt, txt2.txt, txt3.txt", screen would display these filenames to user.
Derek
Last edited by derekn; Jul 21st, 2009 at 10:32 pm.
•
•
Join Date: May 2009
Posts: 1
Reputation:
Solved Threads: 0
I use IO::Uncompress::Unzip like so
Hope this helps.
L
Perl Syntax (Toggle Plain Text)
#!/usr/bin/perl -w use IO::Uncompress::Unzip qw($UnzipError); my $zipfile = "t.zip"; my $u = new IO::Uncompress::Unzip $zipfile or die "Cannot open $zipfile: $UnzipError"; my $status; for ($status = 1; ! $u->eof(); $status = $u->nextStream()) { my $filename = $u->getHeaderInfo()->{Name}; print "$filename\n" ; } die "Error processing $zipfile: $!\n" if $status < 0 ;
Hope this helps.
L
![]() |
Similar Threads
- Rename contents of zip file on extraction? (Visual Basic 4 / 5 / 6)
- zip file download from web browsers (Web Browsers)
- zip file upload (PHP)
- how to display a pdf file in vb 4? (Visual Basic 4 / 5 / 6)
- can picturebox display pdf file in vb4? (Visual Basic 4 / 5 / 6)
- How do I put one list control and a window to display a pdf file (Visual Basic 4 / 5 / 6)
- Copy File Contents to an Array (C)
- How to display a HTML file (in browser window) from Java Program...? (Java)
- zip file extraction (Java)
Other Threads in the Perl Forum
- Previous Thread: kindly help
- Next Thread: Syntax Error if try block added
| Thread Tools | Search this Thread |





