in reply to Re: Downloading a file
in thread Downloading a file

print "Content-disposition: inline; filename=$filename\n";
In my experience, if you use "inline", the browser will try to show it itself, but if you use "attachment" instead, it'll download it to disk.

Also, I think it's (probably) safer to quote the filename.

print "Content-disposition: attachment; filename=\"$filename\"\n";
That's from memory, I haven't rechecked it in practice.

A few online references: