Jump to content

file_exists () problem


glenelkins

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.