Clean up upload file function