Any ideas and/or suggestions are welcome. Thanks in advance!#! C:\perl\bin\perl use strict; use warnings; use diagnostics; use CGI; use CGI::Carp qw(fatalsToBrowser); use BKG::HTML::format; use BKG::INDEX::ver; my ($name, $ver, $comment, $T, $x, $i, $test1, $test2); my $y = 0; my $true=0; my $old = 0; my (@table_dat, @redata, @file_name, @file); # 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; #my @existing_files = BKG::INDEX::ver::Exists($name, $ver); 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 "File upload: $!" +; # foreach (@existing_files) { # if ($file_name[$x-1] eq $_) { # print "Content-type: text/html\n\n"; # print "$_ already exists in this directory. Please c +hoose another name."; # exit; # } # } # if ( $file_name[$x-1] !~ /^([a-zA-Z\d_\s.]+)$/ ) { # print "Content-type: text/html\n\n"; # print "Only letters, numbers, underscores and whitespaces + are allowed in the upload name field!!"; # exit; # } # if ($file_name[$x-1] !~ /\.(jpg|gif|bmp|doc|txt)$/i) { # print "Content-type: text/html\n\n"; # print "Only JPG's, GIF's, BMP's, TXT's and DOC's are allo +wed to be uploaded!!"; # exit; # } $x++; } else { $T=0 } } # loop to upload docs and images $x=0; my ($bytesread, $buffer); foreach (@file_name) { open (OUTFILE, ">/web/aps/mi/$name/$ver/$_") or die "Cannot open $ +name: $!"; binmode(OUTFILE); while ($bytesread=read($file[$x],$buffer,1024)) { print OUTFILE $buffer; } close OUTFILE or die "Close:$!"; $x++; }
In reply to CGI Upload: Bad file descriptor by bkiahg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |