Hello,
I am downloading large file(file size more than1.9GB)
I am using Perl, Mason.
When I click to file to download, browser(Firefox) hangs.
I am not able to find what is the exact problem.
Tried to flush the buffer using $m->flush_buffer.but didn’t help.
Can you please help me to find out why it is not working?
Please find the below code which I written
my $file = "$file_name";
if (-e $file) {
local *FH;
open FH, $file or die "Unable to open file";
if (-B $file){
binmode FH;
}
$r->content_type('application/octet-stream');
$r->set_content_length(-s FH);
$r->headers_out->add("Content-Disposition" => qq(attachment; filename=
+"$display_filename"));
my $buffer;
$m->autoflush(1);
while (sysread(FH, $buffer, 262144)) {
$m->out($buffer);
}
$m->autoflush(0);
close FH;
return;
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.