Results 1 to 5 of 5

Thread: Hyperlink to prompt Open/Save Text File

  1. #1
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Hyperlink to prompt Open/Save Text File

    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:

    HTML Code:
    <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?

    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default

    You'll need a "force download" script (php)
    --------------------------------------------------
    Reviews, Interviews, Tutorials, and STUFF
    --------------------------------------------------
    Home of the SexyBookmarks WordPress plugin

  3. #3
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    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!

  4. #4
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default

    http://www.elouai.com/force-download.php

    This tells you how to "mask" the security hole... though it's not easily "closed".
    --------------------------------------------------
    Reviews, Interviews, Tutorials, and STUFF
    --------------------------------------------------
    Home of the SexyBookmarks WordPress plugin

  5. #5
    Join Date
    Aug 2008
    Location
    Worldwide
    Posts
    11
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    <Files *.txt>
    ForceType application/octet-stream
    Header set Content-Disposition attachment
    </Files>

    Try that as an .htaccess file

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •