DarkPrince2005 Posted July 22, 2012 Share Posted July 22, 2012 Hi Guys I have a piece of code that checks if a file exists in a location, and if it does to then display a specific icon. The problem I'm having is that the file does exist but my code says it doesn't. The file name contains an & character. Any solutions???? if(file_exists('quotes/'.htmlentities($row["Quote_ID"]).'-'.htmlentities($row["Client"]).'-'.htmlentities($row["QuoteRevision"]).'.pdf')){ echo '<a href="quotes/'.htmlentities($row["Quote_ID"]).'-'.htmlentities($row["Client"]).'-'.htmlentities($row["QuoteRevision"]).'.pdf" target="_blank"><img src="images/icons/pdf.png" border="0" title="View File" /></a>'; } else { echo '<a href="quote_pdf.php?id='.htmlentities($row["Quote_ID"]).'&cid='.htmlentities($row["Client"]).'&rev='.htmlentities($row["QuoteRevision"]).'&redirect=quote_list"><img src="images/icons/pdf_inac.png" border="0" /></a>'; } Link to comment https://forums.phpfreaks.com/topic/266086-file_exists-and/ Share on other sites More sharing options...
xyph Posted July 22, 2012 Share Posted July 22, 2012 Yeah, check what file you're actually checking for. htmlentities will convert & to & Link to comment https://forums.phpfreaks.com/topic/266086-file_exists-and/#findComment-1363528 Share on other sites More sharing options...
jazzman1 Posted July 22, 2012 Share Posted July 22, 2012 What kind if result you got it : echo basename('quotes/'.htmlentities($row["Quote_ID"]).'-'.htmlentities($row["Client"]).'-'.htmlentities($row["QuoteRevision"]).'.pdf'); Link to comment https://forums.phpfreaks.com/topic/266086-file_exists-and/#findComment-1363531 Share on other sites More sharing options...
DarkPrince2005 Posted July 22, 2012 Author Share Posted July 22, 2012 Thanx xyph, easy and stupid error... lol. Link to comment https://forums.phpfreaks.com/topic/266086-file_exists-and/#findComment-1363532 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.