extract the file sending function from the Publish component