Index: upload.pl =================================================================== --- upload.pl (revision 25731) +++ upload.pl (working copy) @@ -8,10 +8,10 @@ my $cgi = basename $0; my $filename = param("upfile"); -my $tmpfile = CGI::tmpFileName($filename); +my $fh = CGI::upload("upfile"); $filename =~ s/[\;\:\!\?\*\"\'\,\ ]/_/g; -print STDERR "Uploading $filename\n"; +print STDERR "Uploading $filename to $destpath/$filename\n"; print "Content-type: text/plain\n"; @@ -27,13 +27,12 @@ exit; } -if (move($tmpfile, "$destpath/$filename")) { - chmod 0660, "$destpath/$filename"; # chmod ug+rw - print "Status: 200 Upload successful\n"; +open OUTFILE, ">$destpath/$filename"; +while ($bytesread=read($fh,$buffer,1024)) +{ + print OUTFILE $buffer; } -else { - print "Status: 502 Move failed: $!\n"; -} +print "Status: 200 Upload successful\n"; print "\n$destpath/$filename\n"; print STDERR "\n$destpath/$filename\n";