Oihana Php Ftp

FtpTransferMode uses ConstantsTrait

Enumerates the FTP transfer modes and maps them to the `ext-ftp` resource constants.

Binary is the safe default: ASCII mode rewrites line endings and must only be used for text payloads on platforms that need the translation.

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Constants

ASCII  : string = 'ascii'
Text mode — performs end-of-line translation. Maps to `FTP_ASCII`.
BINARY  : string = 'binary'
Binary mode — byte-for-byte transfer. Maps to `FTP_BINARY`.

Methods

getDefault()  : string
Returns the default transfer mode.
toResource()  : int
Resolves a transfer-mode constant to its `ext-ftp` resource value.

Constants

ASCII

Text mode — performs end-of-line translation. Maps to `FTP_ASCII`.

public string ASCII = 'ascii'

BINARY

Binary mode — byte-for-byte transfer. Maps to `FTP_BINARY`.

public string BINARY = 'binary'

Methods

getDefault()

Returns the default transfer mode.

public static getDefault() : string
Return values
string

The BINARY mode.

toResource()

Resolves a transfer-mode constant to its `ext-ftp` resource value.

public static toResource(string $mode) : int
Parameters
$mode : string

One of the transfer-mode constants. Any unknown value falls back to binary.

Return values
int

Either FTP_ASCII or FTP_BINARY.

On this page

Search results