allow upload_image() to use file objects