Link to home
Start Free TrialLog in
Avatar of DJMgraphix
DJMgraphixFlag for United States of America

asked on

Simple Rollover Downloadable PDF

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!
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

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.
Avatar of DJMgraphix

ASKER

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
What server side languages are available?

PHP, ASP, ?
honestly... whatever you want :)

I'll implement anything that is provided
SOLUTION
Avatar of SaigonJeff
SaigonJeff
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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');
?>
>> 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.
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