#!/usr/bin/perl -w use warnings; use CGI qw/:standard/; use CGI::Carp 'fatalsToBrowser'; use POSIX; print header, start_html('upload form'); print start_form(), table( Tr( td("File: "), td(filefield(-name=>'upload', -size=>50, -maxlength=>80), ), ), Tr( td(), td(submit('button','submit'), ) ) ), end_form(), hr; if (param()) { my $filename = param('upload'); while (<$filename>) { print; } open (OUTFILE,">>/home/myname/public_html/upload") || die $!; while ($bytesread=read($filename,$buffer,1024)) { print OUTFILE $buffer; print "the thing is open"; } close $filename; print "The file should be uploaded if everything went right, which it probably didn't.\n"; }