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
Quote Reply
Re: [Westin] Can somebody fix this for me please? In reply to
Hi,

Wrong forum ;) (I've moved it for you)

Afraid I don't know much about PHP (been years since I used it last), so can't really be much help with your question, sorry.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates