Add a function to detect mime type, even if file_info is not available