Log in

View Full Version : Display Link if file exists



jcarr
03-07-2006, 02:13 PM
I’m looking for some code to show a link to a file (PDF document) if it exists.
If the PDF document doesn’t exist, I don’t want the link or the description to be displayed.

Explanation:-

This is for a web page that has a list of competition results throughout the year

e.g.


2006-06-25 Results 03 (link to “20060625.pdf”)
2006-05-07 Results 02 (link to “20060507.pdf”)
2006-04-01 Results 01 (link to “20060401.pdf”)
2006-03-25 Results 03 (link to “20060325.pdf”)
2006-03-07 Results 02 (link to “20060307.pdf”)
2006-02-01 Results 01 (link to “20060201.pdf”)


I want to create the web page with all the competition dates through the year, but only to display the ones that have the associated PDF uploaded (e.g. If only "20060201.pdf" & "20060307.pdf" just the bottom 2 lines would be displayed on the page)

Thanks in advance

John

Twey
03-07-2006, 04:39 PM
This really ought to be done server-side. With AJAX it's possible, but not advisable.

jcarr
03-08-2006, 08:31 AM
Being a novice at HTML this reply means little to me. When you say "This really ought to be done server-side" are you saying that what I’m after can't be done in JavaScript or something like that??

I was hoping for a simply solution if there is such a thing

Thanks
John

Twey
03-08-2006, 03:54 PM
When you say "This really ought to be done server-side" are you saying that what I’m after can't be done in JavaScript or something like that?Yes. You would need to use a server-side language like PHP (http://www.php.net/) or ASP, which would need to be configured on your server.