using io.copy to transfer file