Improved version of upload_to_sftp