Question : How To Force A Download Prompt For A Text File On The Web

Hello,

I have a webserver running Apache 2.

One of its directories contains text files for download with a non-.txt extension (e.g. file1.yyz, file2.yyz, etc.).

Currently when a user goes to the corresponding URL (e.g. http://mywebserver.com/dir1/file1.yyz) the file is displayed in the browser window. I would instead like the user to get a download prompt, as would happen with an .exe file, for example.

How do I accomplish this?

I realize that this may not necessarily be an Apache issue, but instead might involve settings in the browser (Firefox) or with Windows file associations. If this is the case, that is okay, since there won't be many users who need to download the files.

Thanks in advance,

s1m0ne

Answer : How To Force A Download Prompt For A Text File On The Web

Just:
  SetEnvIf Request_URI "\.yyz$" requested_yyz=yyz
  Header add Content-Disposition "Attachment" env=requested_yyz

You need mod_header and mod_setenvif
http://httpd.apache.org/docs/2.0/mod/mod_setenvif.html#setenvif
Random Solutions  
 
programming4us programming4us