Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6870565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:41:56+00:00 2026-05-27T03:41:56+00:00

I have this Perl/CGI to upload files and get the uploaded file size while

  • 0

I have this Perl/CGI to upload files and get the uploaded file size while uploaded.

The script works fine for files under 500MB but the buffer (OUTFILE) stops writing the file after around 500MB.
Here’s the partial code:

$u_size = $ENV{'CONTENT_LENGTH'};
if ($u_size > $max_size) {send_error ("Upload too big.  Maximum size is $max_size bytes and your file is $u_size bytes.");}

print_progress(0);
# Set up uploading function
$query = CGI->new(\&hook);

#define functions
sub hook  {
    if ($error) {return;}
    if (time >= $next_print) {
        $next_print = time + $delay;
        my ($filename, $buffer, $bytes_read, $data) = @_;
        if ($check_mime) {
            $filename =~ m/\.([^\.]+)$/;
            $ext = lc($1);
            print $ext;
            $check_mime = 0;
        }
        $percent = $bytes_read / $u_size;
        $filename =~ m/\\([^\\]+)$/;
        $filename = $1;
        print_progress($percent, $u_size, $bytes_read, $filename);
    }
}

sub print_progress {
    open(PROG, '>'.$uploaded_file_progress);
    print PROG '{"percent" : ' . ($_[0] * 100) . ', "total" : ' . $_[1] . ', "uploaded" : ' . $_[2] . ', "filename" : "' . $_[3] . '"}';
    close PROG;
}

#############

$uphandle = $query->upload($query->param());
binmode $uphandle;

if (!$error) {
    open OUTFILE, ">" . $uploaded_file;
    binmode OUTFILE;
    while($bytesread = read $uphandle, $buffer, 1024) {
      print OUTFILE $buffer;
    }
    #while (<$uphandle>) {print OUTFILE $_;}
    close OUTFILE;
}

If the script is not a problem, what other stuff that I have to check?
Thanks.

Edit: I have this in the log: Timeout waiting for output from CGI script.
How do I get rid of this? I couldn’t find a definitive answer on Google.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:41:56+00:00Added an answer on May 27, 2026 at 3:41 am

    I would imagine you need to poke your apache TimeOut configuration variable in the apache conf.

    Seeing as you are using perl, this has been broached a couple of time on perlmonks.org and this link has popped up in response.

    http://www.stonehenge.com/merlyn/LinuxMag/col39.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Perl script sitting in the cgi-bin folder of my Apache server:
I have this Perl script with many defined constants of configuration files. For example:
I have a script that's written in perl, and executed as CGI. It works
I have this in perl return $file->{srv_cgi_url}/dl.cgi/$hash/$fname; where $file->{srv_cgi_url} returns http://s1.site.com/cgi-bin/ how can I
I have this simple cgi script working just fine but I want to add
I have this conditional in a perl script: if ($lnFea =~ m/^(\d+) qid\:([^\s]+).*?\#docid =
I have a Perl script, that's supposed to match this string: Sometimes, he says
I have the following, simplest Perl CGI script: use strict; use warnings; use CGI();
please help! I'm really going nuts with this problem! I have a CGI perl
I have a perl script (Cgi / Apache / Windows) which executes some programs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.