use warnings; use CGI qw/:standard/; 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 $upload = param('upload'); open (OUTFILE,">>/home/myname/public_html/upload") or die "cannot open directory for writing $!"; while ($bytesread=read($upload,$buffer,1024)) { print OUTFILE $buffer; print "the thing is open"; } print "The file should be uploaded if everything went right, which it probably didn't.\n"; }