I'm uploading files in my CGI::Application app, some of them are going to be ~4GB. I think I'm suffering from buffering or something. At the moment a 3.5GB file is failing to upload at around th 10% mark. I've checked the disk space and it's ok. I've added some debug lines to warn out some values so that I can get an idea of what's going on, but none of it is displayed until the file upload has completed. It works well for files we've tested so far, just not this large one.
sub Upload{
my $self = shift;
my $q = $self->query();
my $emailbody;
my $bytes_retreived = 0;
my $bufsize = 1024;
my $buffer = '';
my $fh = $q->upload('upfile');
my $filename = uc( $q->param('upfile') );
return '' if ! $filename;
my $tmp = File::Temp->new(
DIR => $self->cfg('UploadDIR'),
SUFFIX => '.zip',
UNLINK => 0,
);
warn "temp file - $tmp";
binmode $fh;
while (read ($fh, $buffer, $bufsize))
{
print $tmp $buffer;
$bytes_retreived += $bufsize;
warn "bytes recieved: $bytes_retreived"; # I expect to see thi
+s in real time when tailing the error_log
}
close $fh;
#close $tmp;
my $file = $self->session->param('UPLOADPATH') . "/" . $filename;
warn "file -- $file";
move($tmp, $file) or die "file move failed $!";
# some more code follows which isn't relevant to the problem.
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.