PHP Restict by certain type (NOT MIME filetype)

Discussion in 'Programming' started by bjnix04, Aug 11, 2009.

  1. #1
    Hey guys, I've been searching, and I'm completely stumped.

    I'm creating a simple file upload script for hosting a certain filetype by an animation program. When I looked at code for file uploads, the example they always use, are for images.
    "image/gif"
    The file's I'm going to be hosting, are .els files and files like that. Files that are not listed on mime as far as I know.

    How would I get PHP to restrict those filetypes, even though they are not mime?
    or am I just screwed? lol

    Wrong section, please move...
     
    Last edited: Aug 11, 2009
    bjnix04, Aug 11, 2009 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    If you can, add the file mime types to Apache. However, if that is not possible, the final option I see is to check for the file extension - which doesn't necessarily always represents the file type.
     
    ThePHPMaster, Aug 11, 2009 IP
  3. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Couldn't you just alter the code to look at the extension of the filename uploaded?
     
    kblessinggr, Aug 12, 2009 IP