##
#!/usr/bin/perl -CS
use CGI::Carp qw(fatalsToBrowser);
use CGI;
my $cgi = new CGI;
my $file = $cgi->param('file');
$file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
my $name = $2;
open(LOCAL, ">/var/www/mypath/$file") or die "$!: path: /var/www/mypath/$name file: $file";
while(<$file>) {
print LOCAL $_;
}
print $cgi->header();
print "$file has been successfully uploaded... thank you.\n";