cclark40 Posted November 14, 2008 Share Posted November 14, 2008 I assume this is possible in php? I have a page that gives a summary of results from croquet tournaments. http://www.croquetvic.asn.au/associationtournamentscompleted.php Each tournament has a unique identifier "tid". Some of the tournaments have results published in pdf format. I would like to put an IF statement in to provide a link to the pdf if it exists. The pdf filenames will be "tid".pdf and the pdf files will be in a subdirectory called "results" Link to comment https://forums.phpfreaks.com/topic/132650-solved-check-if-file-exists-and-if-yes-then-echo-link-to-it/ Share on other sites More sharing options...
rarebit Posted November 14, 2008 Share Posted November 14, 2008 if (file_exists($fn)) { $iret = 1; } will only work on files, not dirs! Link to comment https://forums.phpfreaks.com/topic/132650-solved-check-if-file-exists-and-if-yes-then-echo-link-to-it/#findComment-689905 Share on other sites More sharing options...
JasonLewis Posted November 14, 2008 Share Posted November 14, 2008 Erm, file_exists can actually check to see if a folder exists as well. Link to comment https://forums.phpfreaks.com/topic/132650-solved-check-if-file-exists-and-if-yes-then-echo-link-to-it/#findComment-689958 Share on other sites More sharing options...
cclark40 Posted November 15, 2008 Author Share Posted November 15, 2008 Too easy - I really am a "know-nothing!!" Worked like a dream first time!! Thanks Link to comment https://forums.phpfreaks.com/topic/132650-solved-check-if-file-exists-and-if-yes-then-echo-link-to-it/#findComment-690639 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.