stas, thanks again, i owe you another espresso!

ok it seems there is some sort of disconnect with modperl , the
apr->upload and method postm, at least in my brainpan!

as the listing are it does not pass the %args to the parseFile or
through to the listing 2 subroutine

if the $apr and if statement lines are flipped in listing 1 handler
subroutine stuffs then it works but the file is not
uploaded...obviously! this is just a basic Apache->request

NOW if i keep the listings the same and take out the method=post in
print form it cycles back to printform sub clearing the form field but
placing the args into the form as hidden fields

if the lines are flipped to a straight Apache->request it processes fine

does this give enough info?


#########################
#                       #
#       listing 1       #
#                       #
#########################
package PP::OtherThing;

use Apache::Constants qw(OK);
use Apache::Request;
use Apache::Util qw(escape_html);
use strict;
use warnings;
use PP::UseMe;

sub handler {
#    my $apr = Apache->request;

  my $apr = Apache::Request->new(
        shift,
        POST_MAX        => 10 * 1024 * 1024,    # in bytes, so 10M
        DISABLE_UPLOADS => 0
    );

    my %args = $apr->args;
    warn Data::Dumper::Dumper(%args);

    if ( $apr->upload ) {
  #  if (%args){
      parseFile($apr);
    }
    else {
      printForm($apr);
    }


}

sub parseFile {
    my $r    = shift;
    my %args = $r->args;
    warn Data::Dumper::Dumper(%args);
    my $html = "<html><body>";


    my $stuff=&PP::UseMe::AddSite($r);
    $html.= "$stuff </body></html>";
    $r->send_http_header('text/html');
    $r->print($html);
}
sub printForm {
    my $r = shift;
    my %args = $r->args;

    my $forms;

    foreach (keys %args){
      $forms.="<input type=hidden name=\"$_\" value=\"$args{$_}\">\n";
    }

    $r->send_http_header('text/html');

    $r->print("<html><body>\n");
    $r->print("<h1>Upload sites</h1>");

    # Output a simple form.
    $r->print(<<EOF);
  <form enctype="multipart/form-data" name="files"
action="/PP/otherthing" method=POST>
    Excel File <input type="file" name="file1"><br>
$forms
    <input type="submit" name="submit" value="Upload these files">
  </form>
 </body></html>
EOF

    return OK;
}
1;

#########################
#                       #
#       listing 2       #
#                       #
#########################
package PP::UseMe;


use Data::Dumper qw(Dumper);
use strict;
use warnings;


sub handler {
    my $r    = Apache->request;
    my %args = $r->args;
    warn Data::Dumper::Dumper(%args);
    &PP::Global::print_html( $r, &AddSite($r) );
}

sub AddSite {
    my $r    = shift;
    my %args = $r->args;
    warn Data::Dumper::Dumper(%args);
    return Data::Dumper::Dumper(%args);
}

1;

-- 
Clayton Cottingham - WinterMarket Networks
Virtual Reality Programming, Design & Evangelist
Phone:(604) 875-1213
Cell: (604) 506-7230
Vancouver, B.C. Canada
[EMAIL PROTECTED]
http://www.wintermarket.net
IM's icq:154964789 hotmail:[EMAIL PROTECTED]
yahoo:[EMAIL PROTECTED]


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to