View Full Version : Hyperlink to prompt Open/Save Text File

08-09-2008, 05:13 PM
Ok this might just be a silly easy question but... I have uploaded a text file to my server and I have a link on one of my web pages to open the text file. I made it like a regular link:

<a href="http://www.website.com/blah.txt">Open file</a>

Whenever a user clicks the link, the txt file opens in the browser. Is there any way to make it show the Open/Save As prompt instead? :confused:

Thanks in advance!

08-09-2008, 06:29 PM
You'll need a "force download" script (php)

08-09-2008, 06:56 PM
Oh ok... is there any way to do this without php? If it has to be done this way, does anyone have some code I can use to accomplish this? (I searched this and it seems, from what I've read, that a lot of the force download scripts out there have security holes)

Thanks in advance!

08-09-2008, 07:03 PM

This tells you how to "mask" the security hole... though it's not easily "closed".

08-09-2008, 08:37 PM
<Files *.txt>
ForceType application/octet-stream
Header set Content-Disposition attachment

Try that as an .htaccess file