diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index d3770588..4fd987d9 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -57,7 +57,7 @@ sub firmware_list_gen $debug = 0; $| = 1; -read_postdata(); +read_postdata({acceptfile => true}); read_query_string(); $node = nvram_get("node"); $tmpdir = "/tmp/web/admin"; diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index a32b8da9..7e56a821 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -165,6 +165,7 @@ sub fgets # (from STDIN in method=post form) sub read_postdata { + my ($pdc) = @_; if ( $ENV{REQUEST_METHOD} != "POST" || !$ENV{CONTENT_LENGTH}){ return; }; my ($line, $parm, $file, $handle, $tmp); my $state = "boundary"; @@ -187,7 +188,7 @@ sub read_postdata if(($parm, $file) = $line =~ /^$prefix name="(\w+)"; filename="(.*)"$/) { # file upload $parms{$parm} = $file; - if($file) { $state = "ctype" } + if($file && $pdc->{acceptfile}) { $state = "ctype" } else { $state = "boundary" } } elsif(($parm) = $line =~ /^$prefix name="(\w+)"$/)