Getting MIME Type (!!!)

Discussion in 'PHP' started by Altari, Apr 30, 2008.

  1. #1
    I'm ripping my hair out here, lol.

    Before, I was simply redirecting to the file to be downloaded via download.php?file=fileid. The guy I'm working with didn't like it that way, because people would have access to the path to the original file.

    So now we're going the route of using the header attachment, which I'm told I need the MIME type for. Every function I use to get it, though, it undefined.

    mime_content_type() is deprecated, and always come back as an undefined function.

    finfo_open() is also undefined.

    finfo_file() is the same thing.

    Any ideas? How can I get the MIME type?
     
    Altari, Apr 30, 2008 IP
  2. eric_basher

    eric_basher Peon

    Messages:
    185
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try this;

    $_FILES["myfile"]["type"]

    assume '$_FILES["myfile"]' is form name..
     
    eric_basher, Apr 30, 2008 IP
  3. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That isn't going to work since I'm providing the file via a database call. $_FILE depends on the browser transmitting data (upload vs download).
     
    Altari, Apr 30, 2008 IP