How To Force A PDF Download.

16 replies
Hey Gang,

Now I'm sure I'm using the wrong tech lingo here but hopefully my point gets across (and I hope I'm in the right forum!).

I've been searching around Google for a while now and can't for the life of me figure out how to link from an email and have the user automatically download a PDF file.

Here's my situation.

I'm writing an email series for my list and want to distribute PDF files through my follow up system. The files are too large for Aweber so I would like to host the file on my site like site.com/download, link to that extension from my email and have the PDF file start downloading automatically.

I don't know if that's just a script I need or whatever but either way I'm completely lost and would REALLY appreciate some help/guidance on this :-).

Thanks gang,

--Curt
#download #force #pdf
  • Profile picture of the author Mr. Enthusiastic
    Hi Curt,

    You can't control whether or not the user's email system automatically downloads pdf files. But you can make the link clear and invite the user to download.

    Inside your email, have the link to the file.
    For example:
    Hey subscriber, I want to make sure you get my new pdf file. It's at:
    http://www.mysite.com/downloads/latest.pdf
    If your email system doesn't download it automatically, be sure to click the link above to get the latest pdf file.
    P.S. I have virus scanned this file and I know that it's safe for both Windows and Mac.

    Of course you might want to explain some more about the benefits of the file, etc.

    Chris
    {{ DiscussionBoard.errors[1613224].message }}
    • Profile picture of the author frieden70
      Hey Chris,

      Thanks for your response but that wasn't exactly what I was looking for.

      I know that I need to get them to click on my link, but what I don't know how to do is once they click the link in the email, have that link download and open up a pdf on my server.

      That's what I'm looking to do :-).

      Thanks!

      --Curt
      {{ DiscussionBoard.errors[1613269].message }}
      • Profile picture of the author Mr. Enthusiastic
        Originally Posted by frieden70 View Post

        what I don't know how to do is once they click the link in the email, have that link download and open up a pdf on my server.
        Oh, you need the other file download thread that's now playing.
        http://www.warriorforum.com/programm...downloads.html
        This has a discussion of what you set up on your server so that once someone hits a particular URL, the server pushes a file to their browser.
        {{ DiscussionBoard.errors[1613308].message }}
        • Profile picture of the author frieden70
          Brilliant buddy! Thanks!

          Now I need to figure out what the heck all of that means!
          {{ DiscussionBoard.errors[1614072].message }}
  • Profile picture of the author rufaswan
    A simpler way to say it:

    1) Copy the code start from <?php to ?> posted by saschakimmel (post #4)
    2) Save it as "dl.php" or whatever name you want.
    3) Put the "dl.php" into the same folder with the pdf file you want you subscribers to download.
    4) Now you give away the link like this:
    http://www.mysite.com/dl.php?file=yourfile.pdf

    Or, if you want to put up a page, use this HTML code
    <a href="http://www.mysite.com/dl.php?file=yourfile.pdf">Download</a>

    Note: The "http://www.mysite.com/" part can be omitted if your page is on the same folder of both "dl.php" and your pdf file.

    - Rufas
    {{ DiscussionBoard.errors[1615353].message }}
    • Profile picture of the author frieden70
      Thanks Rufas!

      You Rock!

      Worked like a charm but I do have one more question if you don't mind.

      I could figure out how to get my file to download if the file was simply one word like test.pdf.

      mysite.com/dl.php?file=test.pdf

      No problems there...

      But what if I have a file that's something along the lines of "first test.pdf"

      I couldn't figure out what the link would actually be for that.

      I tried
      mysite.com/dl.php?file=first test.pdf
      mysite.com/dl.php?file=first_test.pdf
      mysite.com/dl.php?file=first-test.pdf

      and none of those worked.

      The reason I'd like to know is because I'd really like to have the file with the full title (that has some copy in it :-)) so if the file happens to sit on their hard drive for days/months or whatever, and they happen to pass by it, it catches their eye and they read it and perhaps buy later.

      That's my ideal situation

      Let me know if you can help on that last technicality :-).

      Cheers!

      --Curt
      Originally Posted by rufaswan View Post

      A simpler way to say it:

      1) Copy the code start from <?php to ?> posted by saschakimmel (post #4)
      2) Save it as "dl.php" or whatever name you want.
      3) Put the "dl.php" into the same folder with the pdf file you want you subscribers to download.
      4) Now you give away the link like this:
      http://www.mysite.com/dl.php?file=yourfile.pdf

      Or, if you want to put up a page, use this HTML code
      <a href="http://www.mysite.com/dl.php?file=yourfile.pdf">Download</a>

      Note: The "http://www.mysite.com/" part can be omitted if your page is on the same folder of both "dl.php" and your pdf file.

      - Rufas
      {{ DiscussionBoard.errors[1617343].message }}
      • Profile picture of the author frieden70
        Alright... now this is really starting to make me laugh...

        I just got off the phone with a buddy of mine who's a little more tech savvy than I am and he told me all I had to do was link directly to the file on my server!

        I tried it out... and lo and behold it worked!

        So with that being the case... why have the php file and script?

        I'd love to know the rationale :-).

        Cheers,

        --Curt
        {{ DiscussionBoard.errors[1617445].message }}
        • Profile picture of the author mattalways
          Originally Posted by frieden70 View Post

          Alright... now this is really starting to make me laugh...

          I just got off the phone with a buddy of mine who's a little more tech savvy than I am and he told me all I had to do was link directly to the file on my server!

          I tried it out... and lo and behold it worked!

          So with that being the case... why have the php file and script?

          I'd love to know the rationale :-).

          Cheers,

          --Curt
          If you have a .zip I think it will ask if you link to it... open/save.

          But if you were to just go directly to a .html, .pdf, .php, .wmv, they just open. If you want to download a copy, you need a download script like this.

          I was thinking that though when you said PDF, but I was thinking you wanted people to actually save it to use it later, sort of like an ebook.
          Signature

          Quit wasting your money! If you need a website, get me to do it right! I'll probably even do it for less! Design/Development/Software, I'm your guy! matt@snidge.com
          {{ DiscussionBoard.errors[1617470].message }}
  • Profile picture of the author frieden70
    Yup, that is ideally what I would like to do...

    With Firefox, the file does actually download but not with Safari.

    So with that being said, any suggestions for my other question then? How do I use the script with a file name that has multiple words in it i.e. "The Report"?

    Thanks!

    --Curt
    {{ DiscussionBoard.errors[1617729].message }}
  • Profile picture of the author mattalways
    Did %20 work where the spaces are? If not, wouldn't it be easier to just replace those spaces with dashes to be safe?

    Matt
    Signature

    Quit wasting your money! If you need a website, get me to do it right! I'll probably even do it for less! Design/Development/Software, I'm your guy! matt@snidge.com
    {{ DiscussionBoard.errors[1617802].message }}
  • Profile picture of the author frieden70
    Tried %20 but that didn't work for some reason... the dashes did work when I replaced the spaces with them...

    Thanks!

    --Curt
    {{ DiscussionBoard.errors[1617823].message }}
    • Profile picture of the author mattalways
      Originally Posted by frieden70 View Post

      Tried %20 but that didn't work for some reason... the dashes did work when I replaced the spaces with them...

      Thanks!

      --Curt
      No problem! You should just avoid spaces in file names for the web. Especially if you are using the URL's in e-mail.
      Signature

      Quit wasting your money! If you need a website, get me to do it right! I'll probably even do it for less! Design/Development/Software, I'm your guy! matt@snidge.com
      {{ DiscussionBoard.errors[1618478].message }}
      • Profile picture of the author saschakimmel
        Anways, feel free to ask me directly if I can help
        Signature

        ** Get my ViralListMachine software now for free and build your own list virally by giving away free stuff @ http://www.virallistmachinegiveaway.com **

        {{ DiscussionBoard.errors[1618613].message }}
        • Profile picture of the author frieden70
          Originally Posted by saschakimmel View Post

          Anways, feel free to ask me directly if I can help
          Will do in the future :-).

          I just gotta get some more posts under my belt to PM...
          {{ DiscussionBoard.errors[1621093].message }}
          • Profile picture of the author Mr. Enthusiastic
            Originally Posted by frieden70 View Post

            I just gotta get some more posts under my belt to PM...
            Just toss us a few more good juicy questions and you'll be there.
            {{ DiscussionBoard.errors[1621404].message }}
  • Profile picture of the author sweeper
    Another way is to add a .htaccess file into your pdf subfolder, and any pdf files in it will be downloadable right away:

    <Files *.pdf>
    ForceType application/octet-stream
    </Files>
    {{ DiscussionBoard.errors[1618473].message }}

Trending Topics