Conn2Flow
Docs navigation

Reference / Libraries

ftp.php library

An FTP/FTPS connection kept in $_GESTOR and uploading or downloading one file at a time. No callers in the core.

Path in the Gestor bibliotecas/ftp.php

A thin layer over PHP's ftp extension, with one connection per request kept in $_GESTOR['ftp-conexao']. No core module uses it; project deploys are done by the CLI (SSH or API), not by this library.

gestor_incluir_biblioteca('ftp');
if (ftp_conectar(['host' => 'ftp.example.com', 'usuario' => $u, 'senha' => $s, 'secure' => true])) {
    ftp_colocar_arquivo(['local' => '/tmp/report.csv', 'remoto' => 'reports/report.csv']);
    ftp_pegar_arquivo(['remoto' => 'inbox/list.txt', 'local' => '/tmp/list.txt']);
    ftp_fechar_conexao();
} else {
    error_log($_GESTOR['ftp-erro']);
}
  • ftp_conectar() uses ftp_ssl_connect() when secure === true and the function exists; otherwise, unencrypted FTP, silently. It turns on passive mode unless $_GESTOR['ftp-conexao-nao-passiva'] is set. On failure, it stores the message in $_GESTOR['ftp-erro'].

  • ftp_colocar_arquivo() and ftp_pegar_arquivo() use FTP_BINARY by default (modoFTP changes it) and return true/false; without local or remoto, they return null.

  • Without the ftp extension installed, the first call ends in a fatal error.

Functions

Generated from gestor/bibliotecas/ftp.php · 4 functions

4 of 4

ftp_conectar

view source · line 41 ↗
ftp_conectar(array|false $params = false): bool

Estabelece conexão com servidor FTP.

Parameters

$paramsarray|false
Parâmetros da função.

Returns

bool
True se conexão estabelecida com sucesso, false caso contrário.

ftp_fechar_conexao

view source · line 90 ↗
ftp_fechar_conexao(array|false $params = false): bool|void

Fecha a conexão FTP ativa.

Parameters

$paramsarray|false
Parâmetros da função (não utilizado atualmente).

Returns

bool|void
False se não houver conexão ativa, void após fechar.

ftp_colocar_arquivo

view source · line 125 ↗
ftp_colocar_arquivo(array|false $params = false): bool|void

Envia um arquivo para o servidor FTP.

Parameters

$paramsarray|false
Parâmetros da função.

Returns

bool|void
True se upload bem-sucedido, false caso contrário.

ftp_pegar_arquivo

view source · line 169 ↗
ftp_pegar_arquivo(array|false $params = false): bool|void

Baixa um arquivo do servidor FTP.

Parameters

$paramsarray|false
Parâmetros da função.

Returns

bool|void
True se download bem-sucedido, false caso contrário.

Verified against the code at commit 8768245a

Sources:

The Future is Hybrid: Human + AI.

Conn2Flow is the tool. If you need the Architect to design your company's strategy using this technology...

Hire Specialized Consulting