#####Create Perl upload script open(FILE, ">$basedir$q_brieftitle/upload.cgi") || &diedebug("$header Could not create file " . "$basedir$q_brieftitle/upload.cgi: $! . " . "It's possible that your web server will not " . "let me create files even if I own the directory. " . "If you have chmodded $basedir$q_brieftitle/ " . "to 777 and you are still getting this message, " . "then you will need to create your quizzes and " . "answerfiles by hand. :( $footer"); flock(FILE, 2); &get_date; # Note the single quotes in the next line... print FILE <<'EOF'; #!/usr/bin/perl $basedir = "/home/sites/stuff/users/web/up2"; $allowall = "yes"; $theext = ".gif"; $donepage = "http://www.yourpage.com/"; ## DO NOT EDIT OR COPY BELOW THIS LINE ## use CGI; $onnum = 1; while ($onnum != 11) { my $req = new CGI; my $file = $req->param("FILE$onnum"); if ($file ne "") { my $fileName = $file; $fileName =~ s!^.*(\\|\/)!!; $newmain = $fileName; if ($allowall ne "yes") { if (lc(substr($newmain,length($newmain) - 4,4)) ne $theext){ $filenotgood = "yes"; } } if ($filenotgood ne "yes") { open (OUTFILE, ">$basedir/$fileName"); print "$basedir/$fileName"; while (my $bytesread = read($file, my $buffer, 1024)) { print OUTFILE $buffer; } close (OUTFILE); } } $onnum++; } print "Content-type: text/html\n"; print "Location:$donepage\n\n"; EOF close(FILE);
In reply to Re: CGI Question
by Shendal
in thread CGI Question
by koacamper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |