I am trying to build a banner manamgment system that works fine except the user has now stated they will be using .swf files aswel as jpgs and gifs. I have in place my <img src> code which then grabs the image form the DB, but i need to have a script that first checks the file name to see what it is, and if its a jpg it runs the img src tag if its an swf it runs the swf tag. Can anyone help on how i can get the correct extension out of the file name field
thanks Chris
You can use the substr() function. Then use if statements.
$ext= substr($filename, -3, 3); if ($ext="jpg") { echo "<img src='$filename'>";}
ahh worked great, thanks for that