#1
  1. No Profile Picture
    Rehistradong manggagamit ...
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    Cavite, Philippines
    Posts
    116
    Rep Power
    15

    Fatal error: call to undefined function: mime_content_type()


    Hi!

    I can't get the mime_content_type() function to work. I need it to determine the file type of the files that I'm going to attach to my email. Below is how I go through my file attchments:

    1. Upload file.
    2. Save file in temp folder.
    3. Send file to recipient.

    I tried saving the value of $_FILES['filename']['type'] in an array and register it as a session, so that when I have to attach the files, I just look up the type of the file in the array.

    $file_types['curr_file'] = $_FILES['curr_file']['type'];

    But that doesn't work, it returns an integer, 8707 or something...

    So, maybe you know how to make the mime_content_type function to work by just adding a few code in the php file. I am working on a company server, and I don't have permission to change any settings. If you have the source code of the mime_content_type function, may I have it as a last resort?

    Thanks....

    JP
  2. #2
  3. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,196
    Rep Power
    2269
    what version of PHP are you on? mime_content_type is available on v4.3 and up.

    mime_content_type only works on files stored in the file system; you can't check the mime type using that function while its in _FILES - (actually, you don't need to, mime type is contained in $_FILES['userfile']['type']).

    hope that helps ...


    - drgroove
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
    The Most Important Article You Can Read as a Developer
  4. #3
  5. No Profile Picture
    Rehistradong manggagamit ...
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    Cavite, Philippines
    Posts
    116
    Rep Power
    15

    Thanks!


    Thanks drgroove!

    I've reread my code, and i found out that the value in $_FILES['UploadedFile']['type'] was stored properly in the $file_types array but I didn't pass the correct index! my mistake....

    to the administrators, you may delete this thread.... but thanks again drgroove...
    JP

IMN logo majestic logo threadwatch logo seochat tools logo