in reply to Re^2: downloading file with CGI
in thread downloading file with CGI

You have to do both, i.e. use the -attachment header and print the content.  The header tells the browser to prompt with "Save [as...]", using the suggested filename as default.