#! /usr/local/bin/perl -w # # use CGI qw/:standard/; $mdir='/usr/local/www/upload-data/html/measurements'; print "Content-type: text/html\n\n"; print <

Upload Measurement

EOH


$method=$ENV{'REQUEST_METHOD'};

if ($method eq 'POST')
{
 die unless param;
                                                                                
 $fn=$filename = param('attached_file');
 $fn =~s/[^a-z0-9.]/_/gi;
 local($node,$if,$timestamp)=split(/\./,$fn);
 $node=~s/^_tmp_//gi;
 if ((! $node) || (! $if) || (! $timestamp)) {die "Filename Format error.\n";}

 $ndir="$mdir/$node";
 if (! -d $ndir) {mkdir($ndir);}

 $fn=">$ndir/$timestamp.$if";
 open (OUT,$fn) || \
		die "Could not create filename: $fn\n"; 
 print "Received: $filename
\n"; while (<$filename>) { print "LINE: $_
\n"; print OUT $_; if (%. > 1000) {die "File too long.\n";} } close(OUT); } print "
\n";