Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

qbxk's scratchpad

by qbxk (Friar)
on Dec 28, 2005 at 21:04 UTC ( [id://519636]=scratchpad: print w/replies, xml ) Need Help??

here's a demo showing the script executing before the client is through uploading it, this is a proof from an uncertainty we arrived at in the chatterbox with [id://bart]
#!/usr/bin/perl $|++; use strict; use warnings; use lib './lib'; use CGI; print STDERR "Here we are\n\n"; unless( $ENV{REQUEST_METHOD} eq 'POST' ) { #show the itty bitty upload form: my $cgi = new CGI; print $cgi->header() . qq{ Using CGI v.$CGI::VERSION<br> <form action="file_upload" method="post" enctype="multipart/form +-data"> <input type="hidden" name="test" value="value"> <input type="file" name="myFile"> <input type=submit> </form> }; } else { print "Content-Type: text/plain\n\n"; # [sic] can't use CGI yet, 'me +mber? ## print <STDIN>;exit; #peek for wisdom 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} ) { ## my $somevar = $cgi->param('somevar'); #ERROR! #Can't call method "param" on an undefined value warn "Getting an upload for $filename"; $uploads{$filename} = 1; } warn $bytes_read if $buffer; ## print $buffer if $buffer; #back at ya! } }
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-14 04:10 GMT
Find Nodes?
    Voting Booth?

    No recent polls found