phpday 2027 - Call for Papers

ftp_append

(PHP 7 >= 7.2.0, PHP 8)

ftp_append — Append the contents of a file to another file on the FTP server

Description

function ftp_append(
    FTP\Connection $ftp,
    string $remote_filename,
    string $local_filename,
    int $mode = FTP_BINARY
): bool

ftp_append() uploads the contents of local_filename to the FTP server, appending them to remote_filename instead of overwriting it.

Parameters

ftp

An FTP\Connection instance.

remote_filename

The remote file path to append to.

local_filename

The local file path whose contents are uploaded.

mode

The transfer mode. Must be either FTP_ASCII or FTP_BINARY.

Return Values

Returns true on success or false on failure.

Errors/Exceptions

Throws a ValueError if mode is not FTP_ASCII or FTP_BINARY.

Changelog

Version Description
8.1.0 The ftp parameter expects an FTP\Connection instance now; previously, a resource was expected.
8.0.0 Now throws a ValueError if mode is not FTP_ASCII or FTP_BINARY. Previously, an E_WARNING was raised and false was returned.

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top