Update putfile.py

Added check_preconditions() so input validation is handled in one place.