#!/usr/bin/perl $|++; use strict; use warnings; use CGI; unless( $ENV{REQUEST_METHOD} eq 'POST' ) { #show the itty bitty upload form: my $cgi = new CGI; print $cgi->header() . qq{
}; } else { print "Content-Type: text/plain\n\n"; # [sic] can't use CGI yet, 'member? sub hook; my $cgi = new CGI( \&hook, undef, 0 ); #use the hook, and don't use a tempfile, i'll handle that myself, #don't pass any "data" to hook either, what would i pass? my %uploads; sub hook { my ($filename, $buffer, $bytes_read, $data) = @_; my $fh; unless( exists $uploads{$filename} ) { #oh yeah, and $filename might not be unique either, but what other choice do i have?! this condition tells me that it's our first time on this file my $somevar = $cgi->param('somevar'); #ERROR! #Can't call method "param" on an undefined value warn "Getting an upload for $filename"; $uploads{$filename} = 1; } print $buffer if $buffer; #back at ya! } }