
set g_errorMsg 0


# Overload ftp::DisplayMsg
proc ftp::DisplayMsg {s msg {state ""}} {
    global g_config
    global g_errorMsg

    switch $state {
        data    {
            if { $g_config(DataMsgs) } {
                Prim::Info "FTPDATA: $msg"
            }
        }
        control {
            if { $g_config(ControlMsgs) } {
                Prim::Info "FTPCONTROL: $msg"
            }
        }
        error   {
            set g_errorMsg 1
            if { $g_config(ErrorMsgs) } {
                Prim::Info "FTPERROR: $msg"
            }
        }
        default {
            Prim::Info "FTPDEFAULT: $msg"
        }
    }
}

#
#
#
#

# Clear error message flag
set g_errorMsg 0

if { [ftp::Put $ftp_sess $inp_file $outfile] == 1 } {
    # Success?
    if {$g_errorMsg} {
        Prim::Info "Error despite put success - failed!"
        # Do something upon put success despite error

    } else {
        # Do something upon put success

    }
} else {
    # Failure
    Prim::Info "Failed to send file."
    # Do something upon put failure

}



#################################################################

Here's an example of what DisplayMsg outputs for a false-positive
put.


FTPERROR: Timeout of control connection after 15 sec.!
FTPDEFAULT: 3727360 bytes sent in 253 seconds (14732 Bytes/s)

