Re: file_Exists() and case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2008-11-23 at 12:24 -0500, Craige Leeder wrote:
> Stan wrote:
> > 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
> >   
> Yes, case matters, but only of the file name, not the extension (I 
> think). The extension is simply a secondary file-type identifier.
> 
> .jpg = .JPG = .jPg
> 
> I could be wrong.
> 
> - Craige
> 
> 
The extension is part of the filename, so you could have all of the
following files in the same directory:

image.jpg
Image.jpg
IMAGE.jpg
IMAGE.JPG

It's just because Unix-based filesystems allow many more characters to
be used as part of the filename, and thus, as upper and lowercase
characters are different characters with different ascii codes, it
treats them as unique.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux