Gossamer Forum
Home : General : Internet Technologies :

Can somebody fix this for me please?

Quote Reply
Can somebody fix this for me please?
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.

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.

Last edited by:

Westin: Apr 21, 2009, 8:00 AM
Subject Author Views Date
Thread Can somebody fix this for me please? Westin 9431 Apr 21, 2009, 7:57 AM
Post Re: [Westin] Can somebody fix this for me please?
Andy 9128 Apr 21, 2009, 8:43 AM