Retrieve file extension according its MIME type
Posted on 2007-03-20
I have files stored as BLOB records in database, with no further information. I want users to be able to download them, so first I save that BLOB to file and then use "system('file -i -b filename')" command to obtain its MIME type. Now I need to retrieve file extention from that MIME type (so that when user downloads the file, his operating system can open it correctly). Any idea how to retrieve it ?