use file to detect filetype