Page 1 of 1

PHP Help please.

Posted: Sun Dec 16, 2007 12:42 pm
by -Legendary-
Ok, what I'm trying to do is this.

on Tlejftp.com, I want to only display certain codes if it's a certain file type.

First, it will always show the direct link, but if it's a Image type, (jpg, png, gif) display the BBcode for the image, and the bbcode for the Thumbnail, (which auto generates from one of my scripts.) If it was a video/music, I want to embed it, and show embed code. I know how to show all the stuff, I just can't figure out how to only show certain things, for certain file types.


It would be something like

if $filetype == "jpg"
{
echo (all my codes that I want to display for jpg..)
}

I don't know how to get the file type, but I have tried several ways and none seem to work.

Thanks if you can help!

Re: PHP Help please.

Posted: Sun Dec 16, 2007 2:02 pm
by Prey
http://www.w3schools.com/php/php_if_else.asp

Unless you were after how to actually get the uploaded file's type?..

Posted: Sun Dec 16, 2007 2:10 pm
by Tural
Legendary doesn't understand the concept of adapting variables to match what they are in his actual script. If $filetype isn't the variable the script uses (Or in the case I gave you, $filename), then it obviously won't work. It's a very simple substring function to get the file type. I showed you that. The reason it doesn't work is because of the variable names. It helps to have PHP knowledge when coding a PHP script. :|

Posted: Sun Dec 16, 2007 3:32 pm
by -Legendary-
No, you gave $filetype, and the script also used $filetype.

Posted: Sun Dec 16, 2007 3:46 pm
by Tural
So if it's already giving that in the script, what is the problem?