The way to get this to happen is to add a "Content-disposition" header with the value of "Attachment". Of course if you are using Rails send_file or send_data methods you can easily add this header. If, however, the files are being served up directly by your web server then you need to find another way to add this header. If you are using Apache 2 the following directives in your conf file should do the trick:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# don't let browsers open these file types inline | |
SetEnvIf Request_URI "\.pdf$" requested_attachment=pdf | |
SetEnvIf Request_URI "\.doc$" requested_attachment=doc | |
SetEnvIf Request_URI "\.xls$" requested_attachment=xls | |
SetEnvIf Request_URI "\.ppt$" requested_attachment=ppt | |
Header add Content-disposition "Attachment" env=requested_attachment |