Class Part

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

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

Method Detail

__constructsource public

__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 optional 'form-data'
The type of disposition to use, defaults to form-data.

__toStringsource public

__toString( )

Convert the part into a string.

Creates a string suitable for use in HTTP requests.

Returns

string
string

contentIdsource public

contentId( null|string $id null )

Get/set the contentId for a part.

Parameters

null|string $id optional null
The content id.

Returns

string|null
string|null

dispositionsource public

disposition( null|string $disposition null )

Get/set the disposition type

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

Parameters

null|string $disposition optional null
Use null to get/string to set.

Returns

string|null
string|null

filenamesource public

filename( null|string $filename null )

Get/set the filename.

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

Parameters

null|string $filename optional null
Use null to get/string to set.

Returns

string|null
string|null

namesource public

name( )

Get the part name.

Returns

string
string

transferEncodingsource public

transferEncoding( null|string $type )

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
string|null

typesource public

type( null|string $type )

Get/set the content type.

Parameters

null|string $type
Use null to get/string to set.

Returns

string|null
string|null

valuesource public

value( )

Get the value.

Returns

string
string

Properties summary

$_contentIdsource

protected string

The contentId for the part

$_dispositionsource

protected string

Disposition to send

$_filenamesource

protected string

Filename to send if using files.

$_namesource

protected string

Name of the value.

$_transferEncodingsource

protected string

The encoding used in this part.

$_typesource

protected string

Content type to use

$_valuesource

protected string

Value to send.

© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/3.1/class-Cake.Network.Http.FormData.Part.html