For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > June 2006 > problems uploading multiple files from separate filefields









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author problems uploading multiple files from separate filefields
Alonze Woodfield

2006-06-17, 7:56 am

Hello,

Thank you in advance for reading this. I am trying to upload several
files at once via seperate filefields. What is strange is that if I
have more than 1 per form, and submit, then if the two filefields have
different files, neither shows up with an upload() call. If I only
attempt to upload one file at a time, or specify the same file for all
filefields, it works fine. The filefields are all named separately, and
if I specify a file in the second but not the first, my logfile
reflects this.
In other words:

file A specified, no file B specified - works
file A specified, file B identical to A - works
file A unspecified, file B specified - works
file A specified, file B specified - doesn't work, both upload values
are empty

I am on why I cannot specify more than one different file in
my form. I am using XP as a platform. Any help would be greatly
appreciated! Thanks so much!

My two corresponding pieces of code follow:


print $q->start_multipart_form(
-name => 'main_form1');
print 'Enter a filename, or click on the browse button to choose one:
',
$q->filefield(
-name => 'filename1',
-size => 40,
-maxlength => 80);
print $q->hr;
print 'Enter a filename, or click on the browse button to choose one:
',
$q->filefield(
-name => 'filename2',
-size => 40,
-maxlength => 80);
print $q->hr;
print $q->submit(-value => 'Upload the file');
print $q->end_form;

..........................................................................

my $query = new CGI;

print OUT "FIRST FILENAME IS ...".$query->upload('filename1')."... AND
SECOND FILENAME IS ...".$query->upload('filename2')."...";

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com