Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member kennedrw's Avatar
    Join Date
    Mar 2006
    Posts
    72
    Member #
    12717
    I am having a hard time finding some simple code that will, when users click on a download this .pdf link, inititate a box that says, "save .pdf to desktop" instead of opening another browser window. Any thoughts? I've done a few searches an haven't found what I want.

    Actually, I think it does this automatically on my MAC when I just put, "target=outside" but on on my PC.
    my site: textbookpower.com
    my email: rkennedy@ [domain above]

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    You can stream it through a PHP page or somesuch that you can use to set the `Content-disposition' header to `attachment'. Alternatively, you should be able to set up your web server to serve up *.pdf with the Content-disposition header doing the appropriate thing.

  4. #3
    Senior Member imagn's Avatar
    Join Date
    Jul 2007
    Location
    Los Angeles
    Posts
    156
    Member #
    15594
    Try:

    function forceDownload($the_file) {
    $download = $the_file;
    header('Content-Description: File Transfer');
    header('Content-Type: application/force-download');
    header('Content-Length: ' . filesize($download));
    header('Content-Disposition: attachment; filename=' . basename($download));
    header("Pragma: no-cache");
    header("Expires: 0");
    readfile($download);
    }


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:11 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com