SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast jlgarcia's Avatar
    Join Date
    Sep 2001
    Location
    Baja California, México
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Link for download instead of view files

    I want to put some PDF, PowerPoint and Word files in a web site, but I don't want that the users see the files directly inside Internet Explorer. I want that the file begins the download process when the user clicks the link for the file.

    What could be the code for a link where instead of vieving a PDF file or a Word file inside the browser, the file start downloading to the users hard drive like a regular download?

    Thanks for any help on this...
    Use the source, Luke...

  2. #2
    SitePoint Evangelist ClevaTreva's Avatar
    Join Date
    Jan 2004
    Location
    Chipping Campden, UK
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    You can't stop a local setting from being actioned on your files, so if the user has their browser set up to open word, pdf, etc files, the browser will do that. THEY can opt to right mouse click and do save as ... but you can't force them.

    So, if you want them to download them anyway, why not zip them up? This should save quite a bit of bandwidth too. Especially if you offer a normal zip and a 7-zip version (7-zip is rather good at doing normal zip's too - better than pkzip).




    Trevor

  3. #3
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    It depends upon the user-agent that the liveware has however, if you are using Apache Server you could use .htaccess and octet-stream to force downloads.

    For example within the .htaccess file you'ld write:


    Code:
    AddType application/octet-stream .doc
    AddType application/octet-stream .pdf


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
  •