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.

Properties summary

  • $_contentId protected
    string
    The contentId for the part
  • $_disposition protected
    string
    Disposition to send
  • $_filename protected
    string
    Filename to send if using files.
  • $_name protected
    string
    Name of the value.
  • $_transferEncoding protected
    string
    The encoding used in this part.
  • $_type protected
    string
    Content type to use
  • $_value protected
    string
    Value to send.

Method Summary

Method Detail

__construct()source 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.

__toString()source public

__toString( )

Convert the part into a string.

Creates a string suitable for use in HTTP requests.

Returns

string

contentId()source 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

disposition()source 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

filename()source 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

name()source public

name( )

Get the part name.

Returns

string

transferEncoding()source 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

type()source public

type( null|string $type )

Get/set the content type.

Parameters

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

Returns

string|null

value()source public

value( )

Get the value.

Returns

string

Properties detail

$_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.2/class-Cake.Network.Http.FormData.Part.html