willdk Posted March 13, 2009 Share Posted March 13, 2009 Hello, I use this code in my script, .(file_exists('/home/test/domains/mydomain.com/public_html/files/0123.jpg')? "http://www.mydomain.com/files/0123.jpg": "http://www.mydomain.com/files/nofile.jpg"). But can I check if the file exists in for example files.txt and not the file itself? file.txt: 0123.jpg 0126.jpg ... ??? Link to comment https://forums.phpfreaks.com/topic/149222-check-if-file-exists-but-in-file/ Share on other sites More sharing options...
ratcateme Posted March 13, 2009 Share Posted March 13, 2009 try $files = file("file.txt"); foreach($files as $file){ echo file_exists('/home/test/domains/mydomain.com/public_html/files/$file')? "http://www.mydomain.com/files/$file": "http://www.mydomain.com/files/nofile.jpg") . "<br />"; } untested but i think it should work Scott. Link to comment https://forums.phpfreaks.com/topic/149222-check-if-file-exists-but-in-file/#findComment-783623 Share on other sites More sharing options...
willdk Posted March 13, 2009 Author Share Posted March 13, 2009 @ratcateme Thank you for the example. I still get errors, but maybe it's something with my script. So I to check all first. Link to comment https://forums.phpfreaks.com/topic/149222-check-if-file-exists-but-in-file/#findComment-783636 Share on other sites More sharing options...
ratcateme Posted March 13, 2009 Share Posted March 13, 2009 what errors are you getting if you show me i might be able to help Scott. Link to comment https://forums.phpfreaks.com/topic/149222-check-if-file-exists-but-in-file/#findComment-784017 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.