added automatic file MIME type detection