glenelkins Posted April 10, 2007 Share Posted April 10, 2007 Hi Lets assume we have a folder structure as follows: public_html ->> index.html -->> test ---->> file_exists.php the following code tells me if the file exists or not if ( file_exists ( "../index.html" ) ) { } but if i use one of the following it says the file does not exist if ( file_exists ( "/index.html" ) ) { echo "YES"; } if ( file_exists ( "http://www.website.com/index.html" ) ) { echo "YES"; } Any ideas? This is really annoying Link to comment https://forums.phpfreaks.com/topic/46429-file_exists-problem/ Share on other sites More sharing options...
Asheeown Posted April 10, 2007 Share Posted April 10, 2007 Use complete directory address', for example: /home/test/public_html/index.html Try that and if that works then either the directory your script in isn't the folder above index.html or you require to use a full directory address Link to comment https://forums.phpfreaks.com/topic/46429-file_exists-problem/#findComment-225823 Share on other sites More sharing options...
glenelkins Posted April 10, 2007 Author Share Posted April 10, 2007 well it usually doesnt do this. Even on windows it still does it? This is to enable video downloads on remote servers, it checks the file exists first for example file_exists ( "http://www.site.com/videos/video.wmv" ); now im not sure at all why its not working, because I can open file content like this file ( "http://www.site.com/videos/video.wmv" ); obviously the output from a video file is a load of garbage but you see what im saying? Link to comment https://forums.phpfreaks.com/topic/46429-file_exists-problem/#findComment-225838 Share on other sites More sharing options...
Asheeown Posted April 10, 2007 Share Posted April 10, 2007 You cannot check if a remote file exsists from an http url, you either need to be FTPed to the machine or the file needs to be on your machine. Link to comment https://forums.phpfreaks.com/topic/46429-file_exists-problem/#findComment-225847 Share on other sites More sharing options...
glenelkins Posted April 10, 2007 Author Share Posted April 10, 2007 mmm, I suppose thats pretty much true, but it still does not explain why file_exists ( "../filename" ); works but "/filename" does not, considering the video file is embedded in the page content with SRC="/filename" Link to comment https://forums.phpfreaks.com/topic/46429-file_exists-problem/#findComment-225915 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.