+ Reply to Thread
Results 1 to 5 of 5

Thread: Automatically "Save Target As..."
      
   

  1. #1
    tcampbell's Avatar
    tcampbell is offline Corporal
    Join Date
    Jan 2008
    Posts
    13

    Question 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. #2
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default 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

  3. #3
    tcampbell's Avatar
    tcampbell is offline Corporal
    Join Date
    Jan 2008
    Posts
    13

    Question 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?

  4. #4
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default 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

  5. #5
    tcampbell's Avatar
    tcampbell is offline Corporal
    Join Date
    Jan 2008
    Posts
    13

    Default Re: Automatically "Save Target As..."

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49