Click to See Complete Forum and Search --> : CGI Error


Termite
10-21-2003, 07:41 AM
I have modified an upload script to upload images to my server.

The script handles small images up to about 20 k with no problems. If I try to upload a 400k image it returns the following error:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

The code I am using is:

#!/usr/bin/perl -w

use CGI;



$query = new CGI;

$upload_dir = $query->param("location");
$filename = $query->param("FileName");
$name = $query->param("ImageName");
$cat = $query->param("Category");
$filename =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("FileName");

open UPLOADFILE, ">$upload_dir/$filename";

binmode UPLOADFILE;

while ( <$upload_filehandle> )
{
print UPLOADFILE;
}

close UPLOADFILE;

print $query->header ( );
print <<END_HTML;

<HTML>
<HEAD><TITLE>Thanks!</TITLE></HEAD>
<BODY>

<SCRIPT Language=Javascript>
location.replace("http://www.remax-properties.co.uk/member/library/ProcessUploadImage.asp?Cat=$cat&file=$filename&Name=$name");
</SCRIPT>

</BODY>
</HTML>

END_HTML

Any help would be great !

jimr451
10-22-2003, 07:04 AM
Hi,

How long is the transfer taking for the 400k image? Some servers set a connection timeout, which you might be hitting. If you ask your ISP, they can confirm and maybe increase the timeout. Perhaps you should "time" a few uploads and see if it's always cutting out at the same time.

I'm not aware of any limitations in the upload size in Perl.

Another thing is to make sure your ISP has enough space for the images - they may either have a quota set on your account, or simply be running the machine with a maxed out filesystem.

Hope this helps.

-Jim