Link to home
Start Free TrialLog in
Avatar of SiobhanElara
SiobhanElaraFlag for United States of America

asked on

How can I do a case sensitive FileExists in CFML?

I've inherited an ancient Cold Fusion site and the file structure that comes with it. My issue is that it had been on a Linux server (case sensitive) and is now on a Windows server (case insensitive) which is causing conflicts. The file names are stored in a MySQL database and the code to render them is simply:
<img src="img/projects/#photo_file#" alt="#photo_name#"/>

Open in new window

Is there a way to check if a file with the exact name exists, like if the stored name in the database is mypic.jpg it won't return MYPIC.JPG? I've found a lot of people asking how to make comparisons case insensitive, but not the other way around. Thanks!
ASKER CERTIFIED SOLUTION
Avatar of dgrafx
dgrafx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SiobhanElara

ASKER

"Causing conflicts" might have been the wrong way to phrase it. What I meant was if Project 1 had the associated file pic.jpg and Project 2 had the associated file PIC.JPG, the pages for Project 1 and 2 would both show the same image.

I did what you recommended and it's working exactly as I wanted... thanks so much!
Glad it worked!

Curious again - so now you are going to rename files? What's the next step? Just curious ...
I'm honestly not sure; this is obviously a stopgap measure, but it doesn't look like we were supplied with all the required images (since there may be records for pic.jpg, PIC.JPG, Pic.jpg, and pic.JPG but we only have pic.jpg in the archive file.) I'll have to see if I can get access to the old server and, if so, hopefully write some code to automate the renaming and updating of records.
Right! Cause as you know on Windows abc.jpg cannot exist in the same folder as ABC.jpg. I'm wondering if during a copy to give you guys the files if duplicates were simply eliminated - or renamed.

Anyway good luck! Have a great day!