upload_file.py: better error handling
upload_file: test it