save_file() function added and is used by PULL on client