add a check on upload_file