Click to See Complete Forum and Search --> : Help with Downloads


elcheque
02-13-2005, 02:48 PM
I need a quick primer on how to code the HTML to download files (e.g. pdfs).

Thanks

ray326
02-13-2005, 02:56 PM
Just put an anchor with the target file url as the href.

elcheque
02-13-2005, 03:10 PM
Originally posted by ray326
Just put an anchor with the target file url as the href.

Thanks for the reply. Obviously, I am a rank beginner.

If I had a site, www.mysite.com, and a pdf with the name of "file.pdf" resided in a folder called "downloads" - what would the HTML (link) look like?

elcheque
02-13-2005, 04:01 PM
Originally posted by ray326
Just put an anchor with the target file url as the href.

Actually, I have already done as you suggested. The syntax I used was:

<a href="URL">Download PDF</a>

When I click on "Download PDF", instead of downloading the file my browser is trying to open it.

Do downloadable files need to reside in a special directory or folder?

ray326
02-13-2005, 10:58 PM
No, you can't force a download with HTML. The configuration of the browser determines how it responds to "unusual" content. If you have some server side programming available to you then you can make the href in the anchor a reference causing a server side response that *may* get the result you desire for *some* users. The most consisten alternative is to tell them to right-click the link and do a save as.

elcheque
02-14-2005, 09:15 AM
Originally posted by ray326
No, you can't force a download with HTML. The configuration of the browser determines how it responds to "unusual" content. If you have some server side programming available to you then you can make the href in the anchor a reference causing a server side response that *may* get the result you desire for *some* users. The most consisten alternative is to tell them to right-click the link and do a save as.

Actually it turned out to be a problem specific to Safari (Mac browser) as I was able to successfully download a file from within both IE and Firefox. Thanks for the help.

soccer362001
02-14-2005, 09:23 AM
Your only other option would be to zip the pdf file and link to the zip file.