Hello! Check this out!
(upload a zipped files)

HTML Form:
<form action="upload.pl" method="post" enctype="multipart/form-data"> <input type="File" name="file"> </form>
Perl code ex:
#!/usr/bin/perl use CGI; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $q = new CGI; my $save_dir = "/home/user/www/upload_dir"; my $file = $q->param("file"); open(OUTFILE, ">$save_dir/file.zip") || die "can't create file: $!"; while (read($file, $buffer, 1024)) { print OUTFILE $buffer; } close(OUTFILE); chmod (0666, "$save_dir/file.zip"); my $file_patch = $save_dir . "/file.zip"; my $zip = Archive::Zip->new($file_patch); my @files = $zip->members(); foreach (@files) { my $unzip_file = $_->fileName; $zip->extractMember($unzip_file); if ($zip->extractMember($unzip_file) != 0) { die print "Extraction of $file failed: $!"; } }

In reply to Re: multiple file upload and CGI by hellomoto
in thread multiple file upload and CGI by nosbod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.