pauleth Posted April 18, 2008 Share Posted April 18, 2008 Do you need to provide an absolute path for this function to work, or can you include a path relative to where the script resides? For example, if I have the php script in a directory called mySite, and I have a directory in mySite called images, can I reference a file in the images directory as: $image = "images/myFile.jpg"; if (!file_exists($image)) { $error = "File does not exist!"; } Thanks in advance for your input. Link to comment https://forums.phpfreaks.com/topic/101725-solved-file_exists-function/ Share on other sites More sharing options...
Daniel0 Posted April 18, 2008 Share Posted April 18, 2008 Did you try? You can use both absolute and relative paths. Link to comment https://forums.phpfreaks.com/topic/101725-solved-file_exists-function/#findComment-520452 Share on other sites More sharing options...
pauleth Posted April 18, 2008 Author Share Posted April 18, 2008 No, I haven't tried yet. I'm actually at work right now, so it's hard for me to work on this stuff - so I thought I'd just get as much info as possible before I worked on it later. Thanks for the response. Link to comment https://forums.phpfreaks.com/topic/101725-solved-file_exists-function/#findComment-520463 Share on other sites More sharing options...
pauleth Posted April 18, 2008 Author Share Posted April 18, 2008 Sweet, I got it to work with the relative path. Thanks! Link to comment https://forums.phpfreaks.com/topic/101725-solved-file_exists-function/#findComment-520513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.