I have searched off and on for the past 3 weeks for a solution to my
problem.  I am at wits end. . .and thought I would finally ask the
mailinglist.

I had a set of CGI scripts that worked without problem.  I began the process
about 4 weeks ago of moving them to mod_perl.  The suite of scripts are
handled as their own perlHandler collection.  One of the scripts has a form
where a user can either enter data directly, or indicate a file of
equivalent data.

When I use the form to POST without any enctype and if you enter directly
into the form things work correctly.  That is, the data is "massaged" and
sent back to you as downloadable file.  Of course, this form does not handle
file uploads.

Now, I change nothing more than the form enctype to "multipart/data-form".
Now, regardless of how the data is presented in the form (e.g. directly or
via file upload) the browser tries to refresh the screen with the web-page
(which it should not since its only response is to send to the client a file
to download).  However, the web page does not get completely sent, and
consistently stops in the middle of the send.

I have been using the POST2GET snippet to help make the post more
persistent.  In short, my httpd.conf file looks like:

#
# **********************
# ** MOD PERL CHANGES **
# **********************
# limit POSTS so that they get processed properly
<Limit POST>
  PerlInitHandler POST2GET
</Limit>
# force reloading of modules on restart
PerlFreshRestart on
# Perl module primitive mother load on start/restart
#PerlRequire lib/perl/startup.pl
# FLOE application (mod_perl)
PerlModule Apache::DBI
PerlModule floeApp
<Location /floeApp>
  SetHandler perl-script
  PerlHandler floeApp
  PerlSendHeader On
</Location>

And the relevant two snippets of code from the script are:
        ## process incoming
        # if submitted
        my %hash = undef;
        my $initialList = $q->param('initialList') || '';
        my $upload = $q->upload || undef;
        my $fh = $upload->fh if defined($upload);
        if (defined($upload) && $upload) {
                $initialList = '';
                while (<$fh>) {
                        $initialList .= $_;
                }
        }

        ## some processing is done to the POST'ed data
        ## and eventually. . .

        ## send file to client
        print   "Content-type: text/plain\n";
                print   "Content-Disposition: attachment;
filename=list.txt\n\n";

        foreach my $value (sort keys %$hash) {
                chomp($value);
                next unless ($value);
                print "$hash->{$value}$CRLF$value$CRLF";
        }

        exit;


Any ideas?  I would love to get this solved so I can get back to developing
useful scripts.  :)

Thanks!
Ward

Ward W. Vuillemot
Boeing Flight Operations Engineering
Performance Software
tel +01 206-662-8667 * fax +01 206-662-7612
[EMAIL PROTECTED]

Reply via email to