On Mon, 2007-12-10 at 10:16 +0100, Gunnar Hjalmarsson wrote: > Tim Bowden wrote: > > I'm trying to write a small cgi app that takes an uploaded zip file, > > extracts the contents and does some operations on the included files. > > Following is a cut down version of my attempts to understand how to > > manipulate a zip file. It doesn't work (surprise, surprise!) It > > creates an empty file with the correct name, but then dies. It also > > won't work using #!/usr/bin/perl -wT, but I haven't tried to sort that > > yet. Can anyone please point me in the right direction? > > It may be easier to do it in two steps: > 1. Upload and save the zip file to disk without Archive::Zip > 2. Manipulate the file to your liking
That was my first approach, and it works fine (manipulating the zip file on disk using 'system "unzip...";' etc), but I was looking to speed things up by avoiding unnecessary writing to disk. As the zip file is already in a perl object, I figured it would be more efficient to either manipulate it in place (CGI object), or create a new object designed for zip files (Archive::Zip). Is my thinking way off, or is it worth pursuing? > > As regards the first step, you may want to use the CPAN module > CGI::UploadEasy. It should work fine in tainted mode. I've gone and re-read what tainting is all about, and I can see I need to do some reasonable checking of the name of the zip file before I use it to write to disk. Either I develop my own tests, or I rely on CGI::UploadEasy if I can't avoid writing the zip files to disk. > > -- > Gunnar Hjalmarsson > Email: http://www.gunnar.cc/cgi-bin/contact.pl > Tim Bowden -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/