hatrickpatrick Posted August 19, 2007 Share Posted August 19, 2007 Does anyone know if there is a function to check whether a file exists or not? Something like readfile(), but which DOESNT actually output the file. I'm trying to write an upload script, so something like this: if (@readfile("$filename")) { echo "This file exists already"; } else { echo "This file does not exist"; } Anyone know? Link to comment https://forums.phpfreaks.com/topic/65713-function-to-check-if-a-file-exists-or-not-like-readfile-but-no-output/ Share on other sites More sharing options...
plutomed Posted August 19, 2007 Share Posted August 19, 2007 file_exists(); Link to comment https://forums.phpfreaks.com/topic/65713-function-to-check-if-a-file-exists-or-not-like-readfile-but-no-output/#findComment-328239 Share on other sites More sharing options...
hatrickpatrick Posted August 19, 2007 Author Share Posted August 19, 2007 Ah. Never have thought of that, thanks Why DO they make function names so obscure and incomprehensible? EDIT: Wait hang on, how could I get it to read a remote URL? like http://otherserver.com/file.php Link to comment https://forums.phpfreaks.com/topic/65713-function-to-check-if-a-file-exists-or-not-like-readfile-but-no-output/#findComment-328240 Share on other sites More sharing options...
plutomed Posted August 19, 2007 Share Posted August 19, 2007 http://uk2.php.net/file_exists Dunno. Have you tried putting it into the function? I don't think you would be able to..... Link to comment https://forums.phpfreaks.com/topic/65713-function-to-check-if-a-file-exists-or-not-like-readfile-but-no-output/#findComment-328251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.