You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John Saylor <jo...@worldwinner.com> on 2001/09/11 21:10:45 UTC

uploads with Apache::Request failing

Hi

I'm trying to use Apache::Request to upload a file, but it's not
working.

Here's how I initalize the object:
 $s = shift;
 $apr = Apache::Request->new ( $s,
                                DISABLE_UPLOADS => 0 );

And here's the upload code:
	  # using $rv for something beside a return value
	  $rv = $params->{path_dir} . '/list.txt';
	  $fh = new IO::File "> $rv";

	  if ( defined $fh ) {
	    $s = $apr->upload ( 'list_file' );
	    
	    if ( ! defined $s ) {
              $s = 'could not get object from $apr->upload';
	      push ( @{$errors}, $s );
	    }
	    else {
	      $upload = $s->fh;
	      while ( <$upload> ) {
                $fh->print ( $_ );
	      }
	      $fh->close;
	    }
	  }
	  else {
	    $s = 'could not write to ' . $rv . ': ' . $!;
	    push ( @{$errors}, $s );
	  }

And $s never gets defined on this line:
$s = $apr->upload ( 'list_file' );

Any clues, suggestions, &c. welcome.

-- 
\js