A drop-box directory for image files has collected variants by letter-case, for example:
Bonsai.jpg, BONSAI.jpg, Bonsai.JPG, bonsai.jpg
I am making a web app using CodeIgniter to manage these documents on a remote server. This means using
- file_exists() or is_file() to verify
a file’s presence - HTML img tag to display the file graphically
But both these tools use the first match they find, regardless of case. How can I deal with this?
(I noticed this similar question as this, but for Delphi instead of PHP.)
They definitely shouldn’t – at least not on a file system that is case sensitive, like Linux’s default file system (is it still called ext2?). While it’s questionable practice to have those four file in the same directory IMO, neither
file_exists()nor the serving of web resources should show the behaviour you describe.It’s different on Windows: FAT and NTFS are not case sensitive. In your example, only one of the four files you mention can exist in the same directory.