Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

FTPConnect

FTPConnect(cServidor, [nPorta], [cUsuario], [cSenha]) --> lRet

Opens an FTP connection.

FTPConnectAdvPL
01 · OVERVIEW

Overview

The official example supplies host, port, user and password. The historical manual reports false when another connection is active. It does not establish SFTP or FTPS support; protocols differ. The callback receives caller credentials without persisting them. The example prepares an uninvoked callback. The caller must own the test FTP session and its paths; no server or credentials are embedded. (Sources: refs. 1–2.)

02 · SYNTAX

Syntax

FTPConnect(cServidor, [nPorta], [cUsuario], [cSenha]) --> lRet

Parameters

cServidor
CharacterRequired

FTP host.

nPorta
NumericOptional

Port; manual describes FTP default.

cUsuario
CharacterOptional

User from protected configuration.

cSenha
CharacterOptional

Password supplied without source persistence.

Return value

Logical operation success.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed397()
    Local bAction := {|cHost,nPort,cUser,cSecret| FTPConnect(cHost,nPort,cUser,cSecret)}
    // Do not evaluate: caller must prepare session and paths.
Return Nil
Expected result

Prepared block; no FTP operation performed. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Validate permissions, return and session ownership. Close the connection opened by this routine on failure paths too. Do not log passwords.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Exemplo de Funções FTP. TDN; referência de versões históricas. Accessed on 2026-10-26.
  2. Advpl o Manual, versão 1.0, pp. 341–347. Referência histórica; autoria não confirmada. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha