#!/usr/bin/perl use strict; use CGI qw(-private_tempfiles); use File::Copy; $CGI::POST_MAX = 40_000_000; my $c = CGI->new; my $old = '/var/tmp/my $fh'; my $new = '/Fileserver/Frederik/my $fh'; if($c->param) { print $c->header(-charset => 'utf-8'), $c->h2('Result'); my $fh = $c->param('upfile'); # Get the FileHandle from temp-File printf qq(
Dateigröße: %s Bytes, Name der Tmp-Datei: %s
), -s $fh, $c->tmpFileName($fh); # Weitere Informationen aus uploadInfo print "";
foreach my $k(keys %{$c->uploadInfo($fh)}){
printf "%-25s => %s\n", $k, $c->uploadInfo($fh)->{$k};
}
print $c->start_form,
$c->button(-name => 'backbutton', -value => 'Zurück', -onclick => "location.href='/Admin/CGI/upload.pl'"),
$c->button(-name => 'startpage', -value => 'Zurück zum Fileserver', -onclick => "location.href='/'"),
$c->end_form;
print "";
system ("cp $old, $new");
close $fh;
}
else{ # Erzeuge das Upload-Formular
print $c->header(-charset => 'utf-8'),
$c->h2('send a file'),
$c->start_form( -enctype => 'multipart/form-data'),
$c->filefield(-name => 'upfile'),
$c->submit(-name => 'upload', -value => 'Datei hochladen'),
$c->reset(-name => 'clear', -value => 'Feld löschen'),
$c->button(-name => 'back', -value => 'Zurück zur Konfiguration', -onclick => "location.href='/Admin'"),
$c->end_form;
}