#!/usr/bin/perl ## ## File Upload ## ## ## Copyright(c) 2000 Leo Fellermayr use strict; ### GET if ($ENV{'REQUEST_METHOD'} eq "GET") { ## Uploadformular und Liste aktuell vorhandener Uploads print "Content-type: text/html\n\n"; print<<"...";

File-Upload

Datei
 
... open (PIPE, "/bin/ls -l1 /wwwroot/prinzess.dyndns.org/html/intra/uploads |"); my ($addr,$line); my $i = 0; foreach $line () { $i++; if ($i % 2) { print "\n"; } print "
Derzeitige Uploads
\n"; } else { print "
\n"; } chop $line; $addr = $line; $addr =~ s/\ /%20/g; print "$line
\n"; close (PIPE); } # GET ### POST else { ## File-Upload use CGI; my $cgi = new CGI; my $file = $cgi->param('upload'); if (!$file) { print "Content-type: text/html\n\n"; print "Keine Datei ausgewählt!\n\n"; } my $filename = $file; # nur alphanumerische Zeichen, Ziffern und der Punkt (.) $filename =~ s/[^A-Za-z0-9\.]//g; # Punkt am Anfang entfernen (.ht*-Dateien) $filename =~ s/(^[\.])(.*)/$2/g; open (PIPE, ">>/wwwroot/prinzess.dyndns.org/html/intra/uploads/$filename"); while (<$file>) { print PIPE $_; } close (PIPE); print "Location: http://prinzess.dyndns.org/intra/upload.php\n\n"; } # POST