Note that there are some explanatory texts on larger screens.

plurals
  1. POPerl/CGI script fails on large uploads
    primarykey
    data
    text
    <p>I have this Perl/CGI to upload files and get the uploaded file size while uploaded.</p> <p>The script works fine for files under 500MB but the buffer (OUTFILE) stops writing the file after around 500MB. Here's the partial code:</p> <pre><code>$u_size = $ENV{'CONTENT_LENGTH'}; if ($u_size &gt; $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-&gt;new(\&amp;hook); #define functions sub hook { if ($error) {return;} if (time &gt;= $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, '&gt;'.$uploaded_file_progress); print PROG '{"percent" : ' . ($_[0] * 100) . ', "total" : ' . $_[1] . ', "uploaded" : ' . $_[2] . ', "filename" : "' . $_[3] . '"}'; close PROG; } ############# $uphandle = $query-&gt;upload($query-&gt;param()); binmode $uphandle; if (!$error) { open OUTFILE, "&gt;" . $uploaded_file; binmode OUTFILE; while($bytesread = read $uphandle, $buffer, 1024) { print OUTFILE $buffer; } #while (&lt;$uphandle&gt;) {print OUTFILE $_;} close OUTFILE; } </code></pre> <p>If the script is not a problem, what other stuff that I have to check? Thanks.</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload