#!/usr/bin/perl
use CGI qw(param);

$home="/usr/local/e-cron";
$string = $ENV{'QUERY_STRING'};
$string =~s/\///g ;
$project =`echo $string | awk -F\",\" '{print \$1}'`;
$project =~s/\s//g ;
$jobnet =`echo $string | awk -F\",\" '{print \$2}'`;
$jobnet =~s/\s//g ;
$up_file = param("uploadFile");
@file_name = split(/\\/ ,$up_file);
$file_name = pop(@file_name);

$tmp = time();
open (OUTFILE,">../upload_tmp/$tmp") or die "Can't make serverside file!\n";
while ($bytesread = read($up_file,$buffer,1024)) {
  print OUTFILE $buffer;
}
close(OUTFILE);

###############contents insert#########
# redirect to jobnet setting
print "Content-type: text/html\n\n";
print "<html>";
print "<head>";
print "<meta http-equiv=\"refresh\" content=\"0; url=./set_jobnet_form.cgi?${project},${jobnet}\">";
print "</head>";
system("rm ../upload_tmp/$tmp");

