bkiahg has asked for the wisdom of the Perl Monks concerning the following question:
#! C:\perl\bin\perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use BKG::HTML::format; # Some Security Holes Plugged $CGI::POST_MAX = 100 * 1024 * 1024; # limit posts to 100M max my $q = new CGI; ################# # Get form data # ################# $T=1; $x=1; while ($T) { $test1 = "name_upfile" . $x; $test2 = "upfile" . $x; if (($q->param($test1)) and ($q->param($test2))) { $file_name[$x-1] = $q->param($test1); $file[$x-1] = $q->upload($test2) or die "test:$!"; $x++; } else { $T=0 } } mkdir "C:/web/aps/mi/$name", 0755 or die "Cannot make dir: $!"; $x=0; foreach (@file_name) { open (OUTFILE, ">C:/web/aps/mi/$name/$_") or die "Cannot open $nam +e: $!"; binmode(OUTFILE); while ($bytesread=read($file[$x],$buffer,1024)) { print OUTFILE $buffer; } close OUTFILE or die "Close:$!"; $x++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Security Uploading Files
by Joost (Canon) on Apr 18, 2004 at 17:18 UTC | |
by bkiahg (Pilgrim) on Apr 18, 2004 at 17:35 UTC | |
by Vautrin (Hermit) on Apr 18, 2004 at 19:37 UTC | |
by beth (Scribe) on May 26, 2004 at 18:04 UTC | |
by Joost (Canon) on Apr 18, 2004 at 18:01 UTC | |
|
Re: Security Uploading Files
by matija (Priest) on Apr 18, 2004 at 17:16 UTC | |
by bkiahg (Pilgrim) on Apr 18, 2004 at 17:36 UTC |