Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-24-2007, 06:16 AM   PM User | #1
jc4p
New to the CF scene

 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jc4p is an unknown quantity at this point
Figuring out a files extension?

Hi,
I have a html page, where one can upload a file. Now the thing is, I can't figure out how to find the files extension in php! The html page's textbox is for a file, so it doesn't export the input of the textbox as a string, so I can not just look at everything past the dot.
I thought about making the php file read the file and see what the first letters in it were, and identify it by that, but the thing is that is going to take way too much time and way too many if commands. Does anyone know of a simpler way?
jc4p is offline   Reply With Quote
Old 01-24-2007, 06:30 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,687
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
The $_FILES['userfile']['type'] variable will give you the file type of an uploaded file. See Handling file uploads in the manual for more info.
__________________
Fumigator is offline   Reply With Quote
Old 01-24-2007, 07:09 AM   PM User | #3
jc4p
New to the CF scene

 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jc4p is an unknown quantity at this point
Quote:
Originally Posted by Fumigator View Post
The $_FILES['userfile']['type'] variable will give you the file type of an uploaded file. See Handling file uploads in the manual for more info.
Wow I feel stupid now. Thanks!
jc4p is offline   Reply With Quote
Old 01-24-2007, 07:26 PM   PM User | #4
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,687
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
No need to feel stupid, it's how we all learn stuff. Plus, feeling stupid is MY job!
__________________
Fumigator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:24 AM.


Advertisement
Log in to turn off these ads.