koacamper has asked for the wisdom of the Perl Monks concerning the following question:
# Create PERL file... open(FILE, ">$basedir$q_brieftitle/upload.pl") || &diedebug("$header C +ould not create file $basedir$q_brieftitle/answerfile: $! . It's poss +ible 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 you +r files by hand. :( $footer"); flock(FILE, 2); &get_date; print FILE <<'EOF'; #!/usr/bin/perl $basedir = "/path/to/base/dir/"; $allowall = "yes"; $theext = ".gif"; $donepage = "up2.html"; ## 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<br>"; 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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Generating a current basedir
by extremely (Priest) on Sep 27, 2000 at 08:48 UTC | |
|
Re: Generating a current basedir
by little (Curate) on Sep 27, 2000 at 07:12 UTC |