Multiple File upload

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

After form Submit
my [at] filehandles = $query->upload("excel");
print scalar( [at] 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
vijay [ Fr, 28 Dezember 2007 08:17 ] [ ID #1895342 ]

Re: Multiple File upload

vijay [at] iavian.com <vijay [at] iavian.com> wrote:

> [at] files = 4;


That array has one element in it.


> for(my $i=1;$i<=scalar( [at] $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 [at] files instead of [at] $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 )


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
Tad J McClellan [ Sa, 29 Dezember 2007 00:03 ] [ ID #1895381 ]

Re: Multiple File upload

vijay [at] iavian.com wrote:
> 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.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Gunnar Hjalmarsson [ Di, 01 Januar 2008 14:28 ] [ ID #1897480 ]

Re: Multiple File upload

Gunnar Hjalmarsson wrote:

> vijay [at] iavian.com wrote:
>> 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.
>
yes i do
that
at the same with my crew
john.swilting [ Do, 24 Januar 2008 01:27 ] [ ID #1915658 ]
Perl » comp.lang.perl.misc » Multiple File upload

Vorheriges Thema: FAQ 8.41 How do I use an SQL database?
Nächstes Thema: FAQ 9.25 How do I fetch/put an FTP file?