Hola, como puedo conectarme a un servidor FTP que requiere TLS, antes me conectaba sin problema pero ahora requiero ese nivel de seguridad.
Asi funcionaba correctamente:
FtpSendFile(cFTP, cSource, cTarget, nVar41, nVar42, 14147 )
FUNCTION FtpSendFile( cFTPSite, cSource, cTarget, cUser, cPass, nBufSize )
LOCAL oInternet, oFTP
DEFAULT cUser:="", cPass:="", nBufSize:=2000
IF EMPTY(cFtpSite) .or. EMPTY(cSource) .or. EMPTY(cTarget)
MsgInfo("Missing Parameters"+chr(13)+"Usage: FtpSendFile(cFtpSite, cSource, cTarget, cUser, cPass, nBufSize) ","FtpSendFile()")
Return .f.
ENDIF
oInternet := TInternet():New()
IF Empty( oInternet:hSession )
MsgAlert( "Internet session not available!" )
ELSE
oFTP := TFTP():New( cFTPSite, oInternet, cUser, cPass )
IF Empty( oFTP:hFTP )
MsgStop( "Cannot connect to "+cFtpSite )
oInternet:End()
return .f.
ENDIF
ENDIF
SendFiles( cSource, cTarget, nBufSize, oFTP )
oInternet:End()
return nil
//----------------------------------------------------------------------------//
static function SendFiles( cSource, cTarget, nBufSize, oFTP )
local hSource
local cBuffer := Space( nBufSize )
local nBytes
local oFile
if ! File( cSource )
MsgStop( "File not found: " + cSource )
Return .f.
endif
hSource = FOpen( cSource )
oFile = TFtpFile():New( cTarget, oFTP )
oFile:OpenWrite()
FSeek( hSource, 0, 0 )
nFile := 0
while ( nBytes := FRead( hSource, @cBuffer, nBufSize ) ) > 0
oFile:Write( SubStr( cBuffer, 1, nBytes ) )
end
FClose( hSource )
oFile:End()
return .t.
//----------------------------------------------------------------------------//