Leser: 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
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); } }
2009-03-16T14:24:13 LinuxerIch nehme an, er meint die Temporäre Datei die CGI.pm während dem upload anlegt.Was für eine Temp-Datei meinst Du?
1 2 3 4 5 6 7 8 9 10 11
my ($bytesread, $buffer); my $numbytes = 1024; my $filename2 = $query->param('filename'); open (OUTFILE, ">", "$upload_dir/$filename") or die "Couldn't open $upload_dir for writing: $!"; while ($bytesread = read($filename2, $buffer, $numbytes)) { print OUTFILE $buffer; } close OUTFILE;
use File::Temp qw ( tempfile );
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
open(TMP,">","$post_data_file") or &bye_bye ("can't open temp file"); my $i=0; $ofh = select(TMP); $| = 1; select ($ofh); while (read (STDIN ,$LINE, 4096) && $bRead < $len ) { $bRead += length $LINE; select(undef, undef, undef,0.35); # sleep for 0.35 of a second. # Many thanx to Patrick Knoell who came up with the optimized value for # the duration of the sleep $i++; print TMP $LINE; } close (TMP);