def upload_file(self, localFileName, remoteFileName=None, connId='<STR_LIT:default>'):
thisConn = self.__getConnection(connId)<EOL>outputMsg = "<STR_LIT>"<EOL>remoteFileName_ = "<STR_LIT>"<EOL>localFilePath = os.path.normpath(localFileName)<EOL>if not os.path.isfile(localFilePath):<EOL><INDENT>raise FtpLibraryError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>if remoteFileName==None:<EOL><INDENT>fileTuple = os.path.split(localFileName)<EOL>if len(fileTuple)==<NUM_LIT:2>:<EOL><INDENT>remoteFileName_ = fileTuple[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>remoteFileName_ = '<STR_LIT>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>remoteFileName_ = remoteFileName<EOL><DEDENT>try:<EOL><INDENT>outputMsg += thisConn.storbinary("<STR_LIT>" + remoteFileName_, open(localFilePath, "<STR_LIT:rb>"))<EOL><DEDENT>except ftplib.all_errors as e:<EOL><INDENT>raise FtpLibraryError(str(e))<EOL><DEDENT><DEDENT>if self.printOutput:<EOL><INDENT>logger.info(outputMsg)<EOL><DEDENT>return outputMsg<EOL>
Sends file from local drive to current directory on FTP server in binary mode.
Returns server output.
Parameters:
- localFileName - file name or path to a file on a local drive.
- remoteFileName (optional) - a name or path containing name under which file should be saved.
- connId(optional) - connection identifier. By default equals 'default'
If remoteFileName agument is not given, local name will be used.
Examples:
| upload file | x.txt | connId=ftp1 |
| upload file | D:/rfftppy/y.txt |  |
| upload file | u.txt | uu.txt |
| upload file | D:/rfftppy/z.txt | zz.txt |
| upload file | D:\\rfftppy\\v.txt |  |