in reply to Upload in-memory files with WWW:Mechanize
You can use File::Type to get the type of a file in memory.