J
Jason Carlton
Let's say that I have a script that allows the user to manually type
in the file name that they want to open. It would go something like
this:
$filename = param('filename');
open FILENAME "/home/mydomain/$filename" or die;
<do whatever...>
close FILENAME;
(Please overlook any typos above; it's just an example for the sake of
clarity, and not important.)
The question is, what if the file name is "MyFile.txt", but they type
"myfile.txt", "MYFILE.TXT", "mYfILE.txt", or something similar. Is
there a way to open the file and ignore the case of the file name?
Ideally, all of the files would have been saved in lower case, then I
could just lc($filename) and be done with it. But I'm inheriting this,
and what's done is done. I could probably change all of the filenames,
but I'm hoping there's a coding option that would make it unnecessary.
in the file name that they want to open. It would go something like
this:
$filename = param('filename');
open FILENAME "/home/mydomain/$filename" or die;
<do whatever...>
close FILENAME;
(Please overlook any typos above; it's just an example for the sake of
clarity, and not important.)
The question is, what if the file name is "MyFile.txt", but they type
"myfile.txt", "MYFILE.TXT", "mYfILE.txt", or something similar. Is
there a way to open the file and ignore the case of the file name?
Ideally, all of the files would have been saved in lower case, then I
could just lc($filename) and be done with it. But I'm inheriting this,
and what's done is done. I could probably change all of the filenames,
but I'm hoping there's a coding option that would make it unnecessary.