Complete file transfer function.