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 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 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] 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!! 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
Archived
This topic is now archived and is closed to further replies.