Auriga Posted January 18, 2007 Share Posted January 18, 2007 Hi,i have a problem with relative paths... I'm using the following:function get_contents() {$filename = "../images/testimg.png";$filecontents = file_get_contents($filename);return $filecontents;}When i try to run it, it says that the file cannot be found. However, I'm sure that it's placed in /images/whereas the function above is located in /library/Even when I replace the relative paths with absolute paths, i still get the error:$filename = "/images/testimg.png";I don't see what I'm doing wrong... Is there something that i don't see?Thanks! Link to comment https://forums.phpfreaks.com/topic/34771-problems-with-file_get_contents/ Share on other sites More sharing options...
Auriga Posted January 18, 2007 Author Share Posted January 18, 2007 Sorry :) Found the solution! :)It appears that you need to give in the path relative to the php file that calls the function... Quite confusing sometimes these paths in php... Link to comment https://forums.phpfreaks.com/topic/34771-problems-with-file_get_contents/#findComment-163915 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.