Announcement

Collapse
No announcement yet.

Automatically "Save Target As..."

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatically "Save Target As..."

    How can visitors simply click on a download link and have a box pop up automatically for them to rename and save the document to their computer without having to right click on the download link and click "Save Target As..."? I have seen this done on many sites but I don't know how they do it.

    I hope someone can help me.

    www.TannersSermons.com/sermons.html

  • #2
    Re: Automatically "Save Target As..."

    There are multiple ways of doing it. The easiest in my opinion is just adding some lines of code to your .htaccess file in the directory that contains the files you want your users to download

    example:
    Code:
    AddType application/octet-stream .avi
    AddType application/octet-stream .mpg
    AddType application/octet-stream .wmv
    AddType application/octet-stream .mp3
    Just change the .avi, .mpg... whatever to the file extension of the files you want to be downloaded. This way when they click the link it will download instead of opening. (meaning they won't have to right click and save)

    Hope that helps

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

    Comment


    • #3
      Re: Automatically "Save Target As..."

      Thanks for your response. I did everything according to your instructions (at least I think I did): I put the code

      AddType application/octet-stream .wma

      on the .htaccess file, which changed the pictures of all the wma files in that directory to a blue diamond image (so I guess I did something right), but on the site, the files still just open when I click on the download link, unstead of downloading. What did I do wrong?

      Comment


      • #4
        Re: Automatically "Save Target As..."

        I don't know how your have your file structure setup, but it may be an issue with the paths to the files in relation to the .htaccess file. Try just adding it to the .htaccess file in your public_html directory. That should effect all other directories globally.

        If that doesn't work then there is way to do it with php, but if you have a bunch of files it would either mean creating a php file for each download you have, using an predefined list of files that can be downloaded and use url variables to choose which file, or to use a database to manage the files that will be downloaded.

        Register/Login Script
        Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

        Comment


        • #5
          Re: Automatically "Save Target As..."

          Thanks again for the response, I'll give it a try.

          Comment

          Working...
          X