On this page
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
-
$_contentIdprotectedThe contentId for the partstring -
$_dispositionprotectedDisposition to sendstring -
$_filenameprotectedFilename to send if using files.string -
$_nameprotectedName of the value.string -
$_transferEncodingprotectedThe encoding used in this part.string -
$_typeprotectedContent type to usestring -
$_valueprotectedValue to send.string
Method Summary
-
__construct() publicConstructor
-
__toString() publicConvert the part into a string.
-
contentId() publicGet/set the contentId for a part.
-
disposition() publicGet/set the disposition type
-
filename() publicGet/set the filename.
-
name() publicGet the part name.
-
transferEncoding() publicSet the transfer-encoding for multipart.
-
type() publicGet/set the content type.
-
value() publicGet the value.
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
$dispositionoptional '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
stringcontentId()source public
contentId( null|string $id null )
Get/set the contentId for a part.
Parameters
-
null|string
$idoptional null - The content id.
Returns
string|nulldisposition()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
$dispositionoptional null - Use null to get/string to set.
Returns
string|nullfilename()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
$filenameoptional null - Use null to get/string to set.
Returns
string|nulltransferEncoding()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|nulltype()source public
type( null|string $type )
Get/set the content type.
Parameters
-
null|string
$type - Use null to get/string to set.
Returns
string|nullProperties detail
© 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