def putfo(self, fl, remotepath, file_size=<NUM_LIT:0>, callback=None, confirm=True):
with self.file(remotepath, "<STR_LIT:wb>") as fr:<EOL><INDENT>fr.set_pipelined(True)<EOL>size = self._transfer_with_callback(<EOL>reader=fl, writer=fr, file_size=file_size, callback=callback<EOL>)<EOL><DEDENT>if confirm:<EOL><INDENT>s = self.stat(remotepath)<EOL>if s.st_size != size:<EOL><INDENT>raise IOError(<EOL>"<STR_LIT>".format(s.st_size, size)<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>s = SFTPAttributes()<EOL><DEDENT>return s<EOL>
Copy the contents of an open file object (``fl``) to the SFTP server as
``remotepath``. Any exception raised by operations will be passed
through.

The SFTP operations use pipelining for speed.

:param fl: opened file or file-like object to copy
:param str remotepath: the destination path on the SFTP server
:param int file_size:
    optional size parameter passed to callback. If none is specified,
    size defaults to 0
:param callable callback:
    optional callback function (form: ``func(int, int)``) that accepts
    the bytes transferred so far and the total bytes to be transferred
    (since 1.7.4)
:param bool confirm:
    whether to do a stat() on the file afterwards to confirm the file
    size (since 1.7.7)

:return:
    an `.SFTPAttributes` object containing attributes about the given
    file.

.. versionadded:: 1.10