ibanez270dx Posted August 10, 2006 Share Posted August 10, 2006 Hi, How do I check if a file exists on my server? I am currently using an if($filename2) where the $filename2 is thename.xls (the files are located in the same directory). This doesn't seem to work... it just automatically goes to the statement afterward even if the file doesn't exist. Someone please help!Thanks, - Jeff Quote Link to comment https://forums.phpfreaks.com/topic/17183-resolved-check-if-a-file-exists/ Share on other sites More sharing options...
Jocka Posted August 10, 2006 Share Posted August 10, 2006 if(file_exists($filename2))::EDIT::http://us3.php.net/file_exists Quote Link to comment https://forums.phpfreaks.com/topic/17183-resolved-check-if-a-file-exists/#findComment-72775 Share on other sites More sharing options...
spfoonnewb Posted August 10, 2006 Share Posted August 10, 2006 Php manual example:[code]<?php$filename = '/path/to/foo.txt';if (file_exists($filename)) { echo "The file $filename exists";} else { echo "The file $filename does not exist";}?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/17183-resolved-check-if-a-file-exists/#findComment-72777 Share on other sites More sharing options...
ibanez270dx Posted August 10, 2006 Author Share Posted August 10, 2006 wow... that was pretty obvious... :-[ thanks for your help!! Quote Link to comment https://forums.phpfreaks.com/topic/17183-resolved-check-if-a-file-exists/#findComment-72781 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.