[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    file upload problem
From:       John Saylor <johns () worldwinner ! com>
Date:       2005-01-31 23:11:56
Message-ID: 20050131231155.GG5002 () ralph ! worldwinner ! com
[Download RAW message or body]

hi

i'm trying to make this modperl upload handler work and it doesn't. it
keeps giving me absolutely nothing for the file [but gives all the
params and their values just fine].

i'm using apache_1.3.29, mod_perl-1.29, mod_ssl-2.8.16-1.3.29
This is perl, v5.8.2 built for i686-linux
Linux ralph.worldwinner.com 2.4.17-openmosix-r2 #1 Fri Sep 6 10:11:11 GMT 2002 i686 \
Intel(R) Pentium(R) 4 CPU 1.80GHz GenuineIntel GNU/Linux [yes it's an old kernel]

here's the code:

use Apache::Request;

sub handler 
{
  my $r = shift;
  my $text = '';
  
  my $apr = Apache::Request->new ( $r );
  my $upload = $apr->upload;

  if ( defined $upload )
  {
      $text .= "\nUPLOAD\n======\n\n";
      
      $text .= '$upload->name: ' . $upload->name . "\n";
      $text .= '$upload->filename: ' . $upload->filename . "\n";
      $text .= '$upload->size: ' . $upload->size . "\n";
      $text .= '$upload->info: ' . $upload->info . "\n";
      $text .= '$upload->type: ' . $upload->type . "\n";
      $text .= '$upload->tempname: ' . $upload->tempname . "\n";
      
      $text .= "\nFILE\n----\n";
      my $fh = $upload->fh;
  
      while ( <$fh> ) 
      {
        $text .= $_;
      }

      $text .= "\n\n";
  }
  
  my $text .= "NAME\tVALUE\n====\t=====\n\n";
  my @params = $apr->param;
  foreach my $name ( @params ) 
  {
    $text .= $name . "\t" . $apr->param ( $name ) . "\n";
  }
  
  $r->content_type ( 'text/plain' );
  $r->send_http_header;
  $r->print ( $text );

  return OK;
}


so i get the 'NAME	VALUE' thing just fine. but nothing else.

any help is appreciated.

-- 
\js	oblique strategy: ask people to work against their better judgement


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic