Put in file size checks for file handles on the upload_file method.  Also put in more refined logging.