#! perl # # test of file uploading # CGI.pm versions before 2.74 may require a patch to make file # uploading work on VMS. # use CGI; $CRINOID::Reuse = 1; $q = new CGI; print $q->header('text/html'); print $q->start_html('Test File uploading'); ask_upload($q); proc_upload($q); print $q->end_html; sub ask_upload { my $q = shift; print "
requested filename on server: "; print $q->textfield(-name=>'filename', -default=>'', -size=>20, -maxlength=>80); print " ",$q->submit(-name=>'Upload'),$q->endform(),"
\n"; } # # works now, with mod to OPCODE.XS to handle _ & recent changes # in CGI.pm # sub proc_upload { my $q = shift; if (!defined($q->param('uploaded_file'))) { print "
Filename on client: | $f\n"; print " |
Filename on server: | $fn |
\n"; while (<$f>) { s/\&/&/g; ### escape any html stuff s/\</g; ### print $_; } print "