implement _put_file func used by _save func

implement _put_file function using by _save function.