Multiple File upload

V

vijay

Upload form
@files = 4;
for(my $i=1;$i<=scalar(@$files);$i++){
print "File $i Path:&nbsp;";
print $query->filefield('excel');
print "<br><br>";
}

After form Submit
my @filehandles = $query->upload("excel");
print scalar(@filehandles); # Is always 1 even if I upload more than
one file

How do i upload multiple files with the same name and handle it using
cgi-lib?


Thanks
iavian
 
T

Tad J McClellan

@files = 4;


That array has one element in it.

for(my $i=1;$i<=scalar(@$files);$i++){


Where have you defined $files?

You should always enable warnings and strict when developing Perl code:

use warnings;
use strict;

Assumming you meant @files instead of @$files, then the loop
will iterate 1 time, because that is what you told it to do.

If you want a loop that will iterate 4 times, then something
like this will do it:

foreach my $i ( 1 .. 4 )
 
G

Gunnar Hjalmarsson

How do i upload multiple files with the same name and handle it using
cgi-lib?

Unless somebody is inclined to give you a history lesson on cgi-lib.pl,
the Perl 5 module CGI::UploadEasy (with CGI.pm behind the scenes) will
probably do what you need.
 
S

swilting

Gunnar said:
Unless somebody is inclined to give you a history lesson on cgi-lib.pl,
the Perl 5 module CGI::UploadEasy (with CGI.pm behind the scenes) will
probably do what you need.
yes i do
that
at the same with my crew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top