in reply to Re: Re: Creating downloadable files on the fly
in thread Creating downloadable files on the fly
When you say Response object, I assume you write the app in Perlscript, right or ... Anyway below is a snippet c&p'ed from working code
## previous code $Response->{'Buffer'} = 1; $Response->{ContentType} = "application/vnd.ms-excel"; $Response->AddHeader('Content-Disposition', "attachment; filename=$fil +ename"); # 'Specify size so that the browser's progress bar works properly $Response->AddHeader( "Content-Length", -s $long_filename); open(IN, "<$long_filename") || AppendToLog("Unable to open yada yada " +); binmode(IN); my @buf = <IN>; close(IN); BinaryWrite(@buf); $Response->Flush; ## more code sub BinaryWrite(@) { my $output; foreach $output (@_) { if (length($output) > 128000) { BinaryWrite(unpack('a128000 a*', $output)); } else { my $variant =Win32::OLE::Variant->new(VT_UI1, $output); $Response->BinaryWrite($variant); } } }
Please also remember that things will fail if you output anything to STDOUT before
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating downloadable files on the fly
by Anonymous Monk on Oct 10, 2002 at 10:48 UTC |