?
Solved

Simple Rollover Downloadable PDF

Posted on 2009-12-26
9
Medium Priority
?
340 Views
Last Modified: 2012-05-08
Hey Experts!

This should be an easy one!

Creating simple rollovers are not the problem.  I want to make rollover buttons that when clicked download a PDF that I have located in a folder labled "PDF" within my root folder.

I've attempted with just a simple

<a href="http://www.mywebsite.com/PDF/my_pdf.pdf">Click here to download File</a>


on a text link.  On my MAC it works.  It downloads straight to the desktop of my computer.  When I tried it on a PC that I have, it only opened it up in the same window without downloading.

Ideally I would like after you click on the link for it to ask, OPEN or SAVE.

Any recommendations?

THANKS IN ADVANCE!
0
Comment
Question by:DJMgraphix
  • 4
  • 4
9 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 26126094
Hi

The problem you are going to run into is that every user/browser does this differently. Ultimately, this us an area that is under user control.

You have two choices here. You can either write a server-side script that attempts to force the file to download or you can compress the file as a zip an link to the zip.  Browsers will always try to download a zip file so that option is the easier and more effective of the two.
0
 

Author Comment

by:DJMgraphix
ID: 26127350
I guess what would be best if I could get some help writing a server-side script that FORCES the file to download.

My example is if you visit here:

http://www.idatalink.com/compustar/

When you click on the above link, click on "INSTALL GUIDES".   There you can download different install guides.  When you click download either on PC or MAC, Firefox, Safari, IE, etc... it will either ask to download or save... or on my MAC it actually pops up the download window that shows it downloading then saving it to my desktop.

Can someone please help me do this on my website...

Thanks,
DJM
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 26127760
What server side languages are available?

PHP, ASP, ?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:DJMgraphix
ID: 26128041
honestly... whatever you want :)

I'll implement anything that is provided
0
 
LVL 5

Assisted Solution

by:SaigonJeff
SaigonJeff earned 400 total points
ID: 26129586
If you are able to use PHP / MySQL then there is a very good tutorial on how to force pdf downloads
on this site: http://www.phpinclude.net/scripts.php?T=19

Good luck.
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 1600 total points
ID: 26129667
>> honestly... whatever you want :)

For the sake of ease, I want you to zip the PDFs :)

The Expert above links to a tutorial that will work, but assumes a database is used.  You can get away with a simpler script;

<?php
  header('Content-type: application/pdf');
  header('Content-Disposition: attachment; filename="downloaded.pdf"');
  readfile('original.pdf');
?>

above from http://php.net/manual/en/function.header.php

You can modify this if you have PHP knowledge to use the query string to identify one of many files to download.


0
 

Author Comment

by:DJMgraphix
ID: 26131613
Alright Jason1178, I'll go with it your way.  Just to test this I've changed the extension .PDF to .ZIP.

The file is located in a folder labeled "PDF" within my website..

The files actual name is: Business_Professional_Deductions.zip

Is it possible to have a simple rollover button now force that download?  Or does it just have to be text?

Lastly where would I put the following?  Just put it within the same cell as the button?


<?php
  header('Content-type: application/pdf');
  header('Content-Disposition: attachment; filename="downloaded.pdf"');
  readfile('original.pdf');
?>
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 26132951
>> Is it possible to have a simple rollover button now force that download?  

Yes, just create a rollover button and set the link to <a href="Business_Professional_Deductions.zip">.  Or are you asking how to create a rollover?

>> Lastly where would I put the following?  Just put it within the same cell as the button?

No, you would not use the PHP script at all if you are using zip files.  I was presenting two different solutions.  If you have no experience with server-side scripting, this may not be the best place to start.  You will need to get a basic grounding in how to program in a scripting language before tackling that solution.
0
 

Author Comment

by:DJMgraphix
ID: 26134369
I Had to finish the project today.  It turned out pretty good.  I did it the way I normally would.  I wanted to try and force someone to click on OPEN or SAVE.  However time was of the essence.

What I did was make 5 simple rollovers with _blank so they open up in a new window.  From there you can view to the PDF as well as save it afterward if you choose.

You can view it here: http://www.northwaytax.com/tax_service_documents_saratoga_springs_ny.html

A simple fix, however I'll definitely try to implement your way on the next project.

Thanks,
DJM
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ready to get certified? Check out some courses that help you prepare for third-party exams.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question