sintax63 Posted January 14, 2013 Share Posted January 14, 2013 (edited) I've done some searching and digging on here but have come up empty. Maybe it isn't possible or I'm just not using the correct terminology. In any case, here is what I would like to accomplish... I want to query a database for a name (easy peasy) and then see if a file (PDF in this case) named the same name exists in a specific directory. If it does, display a link to it. If not, state the fact no file is found. So if I am querying the database for "1234-5678", it checks "/files/items" for "1234-5678.pdf". Is something like this even possible? Thanks! ------------------------------------------------------------------------------------------------- I'm running a fresh and up to date install of both PHP and MySQL Edited January 14, 2013 by sintax63 Quote Link to comment https://forums.phpfreaks.com/topic/273145-checking-if-a-file-exists-on-server/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 14, 2013 Share Posted January 14, 2013 file_exists Quote Link to comment https://forums.phpfreaks.com/topic/273145-checking-if-a-file-exists-on-server/#findComment-1405587 Share on other sites More sharing options...
devWhiz Posted January 14, 2013 Share Posted January 14, 2013 if(file_exists("./files/items/1234-5678.pdf")){ } Quote Link to comment https://forums.phpfreaks.com/topic/273145-checking-if-a-file-exists-on-server/#findComment-1405588 Share on other sites More sharing options...
sintax63 Posted January 14, 2013 Author Share Posted January 14, 2013 Thanks guys! I'll go read up on file_exists(). Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/273145-checking-if-a-file-exists-on-server/#findComment-1405589 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.