#!/usr/local/bin/perl require 'CGI_LIB.pl'; # For those whose server is on windows system, you need the following three lines. # Thanks to Carlo Maria Piacenti who told me about this. binmode(STDIN); binmode(STDOUT); binmode(STDERR); &Parse_Multi; if (defined $CGI{'SeeUploadedFile'}) { # During your testing on your web server, you can check the size of # ./uploadfile.unknown with the size of the tested file. # If you're using windows system, binmode function is needed for saving # binary data and binmode function should come after open function. open(TMP, "> uploadfile.unknown"); binmode(TMP); print TMP $CGI{'UploadedFile'}->{'Contents'}; close(TMP); print "Content-Type: $CGI{'UploadedFile'}->{'Content-Type'}\n"; # The following will default the filename when the browser asking user to save it. # This only works in netscape. print "Content-Length: ".length($CGI{'UploadedFile'}->{'Contents'})."\n"; print "Content-Disposition: filename=\"$CGI{'UploadedFile'}->{'filename'}\n\n"; print $CGI{'UploadedFile'}->{'Contents'}; } elsif (defined $CGI{'SeeCGIHash'}) { &Print_Head; print "Values of Hash Array \%CGI"; print "

Values of Hash Array \%CGI


"; for $key (sort keys %CGI) { print "
"; if (ref($CGI{$key}) =~ /HASH/) { print "
Hash array of \"$key"; print "\"
Variable NameValue"; for (keys %{$CGI{$key}}) { print "
\$CGI{'$key'}->"; print "{'$_'}$CGI{$key}->{$_}"; print ""; } } elsif (ref($CGI{$key}) =~ /ARRAY/) { $count = 0; print "Array of \"$key"; print "\"
Variable NameValue"; for $count (0..$#{$CGI{$key}}) { print "
\$CGI{'${key}'}\[$count\]"; print "$CGI{$key}[$count]\n"; } } else { print "Single value of \"$key"; print "\"
Variable NameValue"; print "
\$CGI{'$key'}$CGI{$key}\n"; } print "

"; } print "


"; }