CGI: Problem Uploading multiple files... 
Author Message
 CGI: Problem Uploading multiple files...

I have a multi-part form form that uploads multiple files to a perl
CGI.pm based script.  It seems as though I can only upload a single file
per form. Each of the individual INPUT files will upload using the form
but if more than one has a file name entered only the first file
descriptor has data when read.

Anybody else experienced this or have a solution?



Fri, 14 Feb 2003 03:00:00 GMT  
 CGI: Problem Uploading multiple files...

Quote:

> I have a multi-part form form that uploads multiple files to a perl
> CGI.pm based script.  It seems as though I can only upload a single file
> per form. Each of the individual INPUT files will upload using the form
> but if more than one has a file name entered only the first file
> descriptor has data when read.

> Anybody else experienced this or have a solution?

William -

I am assuming that you have each of the html form elements called by a
distinct name? If not, check this because maybe you copied and pasted a bit
too much and didn't get your naming straightened out afterwards. Just a
couple of personal experiences here having written a whole lot of file
upload scripts myself. First, if you are using IE and testing your script,
filling each of the browse boxes with the same exact file, IE will only
upload the first instance of that file, ignoring the remaining instances in
your form. Something of a bug maybe or maybe IE is designed to do this,
don't know. If you are using Netscape and use the form more than once in a
row, for each subsequent upload, Netscape will upload the original file in
the first upload that you performed each time regardless of the fact that
you selected different files in each of the subsequent uploads. Weird but is
appears that Netscape has something of a cache bug in it that causes this
behavior. I recommend testing your code using IE and be sure that each file
box has a different file in it when performing multiple uploads. Other than
that, without seeing any of your code, I cannot offer any further advice
than this.

Albert Dewey



Fri, 14 Feb 2003 03:00:00 GMT  
 CGI: Problem Uploading multiple files...

: > I have a multi-part form form that uploads multiple files to a perl
: > CGI.pm based script.  It seems as though I can only upload a single file
(snip)
: William -
: I am assuming that you have each of the html form elements called by a
(various useful ideas snipped)

Temporarily replace the upload script with a script to dump the posted
data back to the browser so you can see what you really sent. (or save to
a file on the server).

something like (completely untested)

        #!perl
        # temporary file upload script, display what was uploaded
        print "Content-type: text/plain\n\n";
        read(STDIN,$all_the_data,$ENV{'CONTENT_LENGTH'});
        print $all_the_data;
        exit;

Then you can check whether it is the browsers fault or not.  This will
work best if you upload small text files, with indented lines that
identify which file they (the lines) are in.



Sat, 15 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. cgi: multiple file-upload

2. cgi: multiple file-upload

3. Problems with http file upload using cgi.pm and cgi-lib.pl

4. CGI.pm file upload problem

5. Apache mod_perl problem w/ CGI.pm file upload

6. File Upload Problem w/ CGI.pm

7. A problem using CGI.pm to upload files from unix

8. CGI.pm file upload problem - Please Help!

9. cgi.pm - File upload problem....

10. CGI.pm file uploads problem

11. CGI.pm and File Upload Problem

12. CGI.pm file upload problem - Please Help!

 

 
Powered by phpBB® Forum Software