## previous code $Response->{'Buffer'} = 1; $Response->{ContentType} = "application/vnd.ms-excel"; $Response->AddHeader('Content-Disposition', "attachment; filename=$filename"); # '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 = ; 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); } } }