$SIG{__DIE__} = \&my_die; use CGI; $C = new CGI; if ($C->param) { $file=$C->param("upload"); ### if you need to do fancy placement look at ### File::Basename open (UPLOAD, "/path/to/file"); while ($bytesread=read($file,$buffer,1024)) { print UPLOAD $buffer; } print $C->header; print $C->start_html; print qq(

file uploaded successfully

); print $C->end_html; exit; } else { print $C->header; print $C->start_html; print $C->start_multipart_form; print $C->filefield(-name=>'file'); print qq( ); print $C->end_html; exit; } sub my_die { print $C->header; print $C->start_html; print $_; print $C->end_html; }