http://www.perlmonks.org?node_id=26739


in reply to Downloading things from a database

You can actually get away with not knowing the content-type, you just default to application/octet-stream. Give the following a try, it is very nice. All you will need to do is perform a length() on the data and give a filename.

--eric
use CGI; my $size = length ($blob); my $filename = 'good_data.txt'; print CGI::header( -Content-Disposition => "attachment; filename=$filename", -Content-Type => 'application/octet-stream', -Content-Length => $size, -Pragma => 'no-cache', -Expires => 0 ); print $blob;