file_Exists() and case
| From: | Stan | Date: | Sun, 23 Nov 2008 17:05:50 +0000 |
| Subject: | file_Exists() and case | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-283718@lists.php.net to get a copy of this message | ||
If $basePicture = "../pictures/2008 west coast trip/2008-06-10 first week at
Chris'/DSC_0011.jpg"
and the file actually is "../pictures/2008 west coast trip/2008-06-10 first
week at Chris'/DSC_0011.JPG"
(uppercase extension) the following snippet of code
----------------------------------------------------------------------------
-----------------------
/* make sure the picture file actually exists */
if(!file_Exists($basePicture))
{
echo "file = '" . $basePicture . "' doesn't exist.<br>\n";
$extStartsAt = strrpos($basePicture, ".") + 1;
$extOfBasePicture = substr($basePicture, $extStartsAt);
$basePicture =
substr_replace($extOfBasePicture,strtoupper($extOfBasePicture),$extStartsAt)
;
}
else
{
echo "file = \"" . $basePicture . "\" exists.<br>\n";
}
----------------------------------------------------------------------------
-----------------------
generates
----------------------------------------------------------------------------
-----------------------
file = "../pictures/2008 west coast trip/2008-06-10 first week at
Chris'/DSC_0011.jpg" exists.
----------------------------------------------------------------------------
-----------------------
The script is running on an UBUNTU v8.04 LAMP server. Case is supposed to
matter, isn't it?
Thanks,
Stan