\Cake\Http\ClientFormDataPart

Contains the data and behavior for a single part in a Multipart FormData request body.

Added to Cake\Http\Client\FormData when sending data to a remote server.

Summary

Methods
Properties
Constants
__construct()
disposition()
contentId()
filename()
type()
transferEncoding()
name()
value()
__toString()
No public properties found
No constants found
No protected methods found
$_name
$_value
$_type
$_disposition
$_filename
$_transferEncoding
$_contentId
N/A
No private methods found
No private properties found
N/A

Properties

$_name

$_name : string

Name of the value.

Type

string

$_value

$_value : string

Value to send.

Type

string

$_type

$_type : string

Content type to use

Type

string

$_disposition

$_disposition : string

Disposition to send

Type

string

$_filename

$_filename : string

Filename to send if using files.

Type

string

$_transferEncoding

$_transferEncoding : string

The encoding used in this part.

Type

string

$_contentId

$_contentId : string

The contentId for the part

Type

string

Methods

__construct()

__construct(string  $name, string  $value, string  $disposition = 'form-data') 

Constructor

Parameters

string $name

The name of the data.

string $value

The value of the data.

string $disposition

The type of disposition to use, defaults to form-data.

disposition()

disposition(null|string  $disposition = null) : string|null

Get/set the disposition type

By passing in false you can disable the disposition header from being added.

Parameters

null|string $disposition

Use null to get/string to set.

Returns

string|null

contentId()

contentId(null|string  $id = null) : string|null

Get/set the contentId for a part.

Parameters

null|string $id

The content id.

Returns

string|null

filename()

filename(null|string  $filename = null) : string|null

Get/set the filename.

Setting the filename to false will exclude it from the generated output.

Parameters

null|string $filename

Use null to get/string to set.

Returns

string|null

type()

type(null|string  $type) : string|null

Get/set the content type.

Parameters

null|string $type

Use null to get/string to set.

Returns

string|null

transferEncoding()

transferEncoding(null|string  $type) : string|null

Set the transfer-encoding for multipart.

Useful when content bodies are in encodings like base64.

Parameters

null|string $type

The type of encoding the value has.

Returns

string|null

name()

name() : string

Get the part name.

Returns

string

value()

value() : string

Get the value.

Returns

string

__toString()

__toString() : string

Convert the part into a string.

Creates a string suitable for use in HTTP requests.

Returns

string