Hello,
I have a very simple image calling script, this is done so that the images can stay behind the root of the web available directories on the server.
My main problem is that I need this to NOT be case sensitive.
$file = $_GET['file'];
$fileDir = '/home/path to /protected_directory/';
if (file_exists($fileDir . $file))
{
// Note: You should probably do some more checks
// on the filetype, size, etc.
$contents = file_get_contents($fileDir . $file);
// Note: You should probably implement some kind
// of check on filetype
header('Content-type: image/jpeg');
echo $contents;
}
?>
So when someone calls image.php?file=Eve.jpg and there really is a file named Eve.jpg then it gets pulled up just fine. However I'd like to make it so that when someone calls image.php?file=eve.jpg it also pulls up the correct image.
Is this something that someone here can make a simple addition to my existing script to make it so that it's not case sensitive.
Thanks if you can assist me.
I have a very simple image calling script, this is done so that the images can stay behind the root of the web available directories on the server.
My main problem is that I need this to NOT be case sensitive.
Code:
<?php $file = $_GET['file'];
$fileDir = '/home/path to /protected_directory/';
if (file_exists($fileDir . $file))
{
// Note: You should probably do some more checks
// on the filetype, size, etc.
$contents = file_get_contents($fileDir . $file);
// Note: You should probably implement some kind
// of check on filetype
header('Content-type: image/jpeg');
echo $contents;
}
?>
So when someone calls image.php?file=Eve.jpg and there really is a file named Eve.jpg then it gets pulled up just fine. However I'd like to make it so that when someone calls image.php?file=eve.jpg it also pulls up the correct image.
Is this something that someone here can make a simple addition to my existing script to make it so that it's not case sensitive.
Thanks if you can assist me.