work around the lack of a static type system

Check that the file object actually behaves a bit like a file
form field.  This doesn't really help much, though, as we have
to simply trust that `tempfile` is a real file with a path
method, etc.

This should be enough, though, to fail early in case the form
field has been tampered with.