Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Reading CGI.pm file upload spools with Archive::Zip

by OverlordQ (Hermit)
on Sep 01, 2004 at 20:31 UTC ( [id://387697]=note: print w/replies, xml ) Need Help??


in reply to Re: Reading CGI.pm file upload spools with Archive::Zip
in thread Reading CGI.pm file upload spools with Archive::Zip

Hmmm I tried your first code, but i got this:
print "On file: $i\n<br>"; my $filename = $cgi->param("file1") or print "Cannot do that: $!\n"; print "Uploading . . ."; my $upload_filehandle = $cgi->upload("file$i") or print "cant upload: +$!\n"; print "done<br>\n"; print "Making zip . . ."; my $zip = Archive::Zip->new() or print "Canot make zippah: $!\n"; print "done<br>\n"; print "Reading Zip . . . "; my $status = $zip->readFromFilehandle($upload_filehandle); print "done<br>\n"; print "Mah Statuhs: $status\n"; $zip = undef unless ($status eq 'AZ_OK'); if(defined($zip)) { print $zip->members(); } else { print "Ooops something happened: $!\n"; }
But this is what I get for output:
Mungeing!
On file: 1
Uploading . . .done
Making zip . . .done
Reading Zip . . .
Dunno what's up there :-(

Replies are listed 'Best First'.
Re^3: Reading CGI.pm file upload spools with Archive::Zip
by siroskey (Initiate) on Sep 16, 2004 at 01:47 UTC
    I really do not have a explination, and if someone has one I would like to know. You have to make a reference of the dereferenced file handler object. In your case you read line should look like this.

    my $status = $zip->readFromFilehandle(\$$upload_filehandle);

    Here a segement of code that I used to get this working...

    my $fh = $c->upload('zip');
    my $zip = Archive::Zip->new();
    $zip->read(\$$fh);

    my @members = $zip->members();

    foreach my $member (@members){
    my $filename = $member->fileName();
    print "$filename\n";
    }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://387697]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-19 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found