file_exists() not working correctly?
| From: | Chris Haensel | Date: | Mon, 25 Aug 2008 07:14:18 +0000 |
| Subject: | file_exists() not working correctly? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-278627@lists.php.net to get a copy of this message | ||
Good morning list,
I have a _very_ simple function... it is as follows
/**********************************************/
function getgalimage($fzg) {
$folder = "bilder";
$imgname = $fzg."_1.JPG";
$checkimg = $folder."/".$imgname;
if(file_exists($checkimg)) {
//echo '<img
src="mod_search_thumbs.php?bild='.$imgname.'&fzg_nr='.$fzg.'">';
echo '<img src="'.$checkimg.'">';
} else {
echo '<div style="display:block; padding:2px; border:1px
solid red;"><a
href="'.$checkimg.'">'.$checkimg.'</a></div>';
}
}
/**********************************************/
Now, the folder "bilder" exists, and I pass the number 0002822 to the
function. Now it should check whether the image file "bilder/0002822_1.JPG"
exists. It never finds the image, even though it exists (I checked it many
times now)
Could you point out the obvious mistake I am making here? I have checked it
over and over again, and can't find any mistake. I know that sometimes you
get stuck in your code, and don't see the obvious. So I'd like to ask you
all to show me my error :o) I hope you can see something which I can't.
Thanks for your help!!
Chris