Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    No need to feel stupid, it's how we all learn stuff. Plus, feeling stupid is MY job!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •