You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by bioinfo Gu <bi...@yahoo.com> on 2003/07/31 15:54:38 UTC
[users@httpd] slow upload cgi script
Hello,
I have one simple script to implement uploading. But this script is incrediably SLOW running on my Tru64 server. I am using apache1.3.24 or apache1.3.27+modssl. But when I run the same script on another linux server, running Server version: Apache/2.0.40.
I am stuck here for two days, Does anybody have any clue? Thanks a lot.
The following is my script:
test_upload.pl
#!/usr/bin/perl5.8.0 -w
print "Content-type:text/html\n\n";
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $q = new CGI;
my $DATA_DIR = '/compbio/tmp';
my $newfile ;
$_ = $newfile = $q->param("logotype");
s/\w://;
s/([^\/\\]+)$//;
$_ = $1;
s/\.\.+//g;
s/\s+//g;
s/\(//g;
s/\)//g;
$newfile = $_;
unless (open OUTF, ">$DATA_DIR/$newfile") { die("Error opening file: $!\n") }
binmode OUTF;
my $fh=$q->param("logotype");
while(<$fh>){
print OUTF $_;
};
close OUTF;
exit;
Test_upload.html:
<HTML>
<HEAD>
Upload test
</HEAD>
<BODY>
<form method="post" enctype="multipart/form-data" action="/cgi-bin/test_upload.pl">
<input type="file" name="logotype">
<input type="submit">
</form>
</BODY>
</HTML>
Thanks a lot.
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software