use libmagic to retrieve mimetype