Provides an interface for building multipart/form-encoded message bodies.
Used by Http\Client to upload POST/PUT data and files.
__toString( )
Converts the FormData and its parts into a string suitable for use in an HTTP request.
string
add( string|Cake\Network\Http\FormData $name , mixed $value null )
Add a new part to the data.
The value for a part can be a string, array, int, float, filehandle, or object implementing __toString()
If the $value is an array, multiple parts will be added. Files will be read from their current position and saved in memory.
Cake\Network\Http\FormData
$name
$value
optional null mixed
addFile( string $name , mixed $value )
Add either a file reference (string starting with @) or a file handle.
$name
$value
Cake\Network\Http\FormData\Part
addMany( array $data )
Add multiple parts at once.
Iterates the parameter and adds all the key/values.
$data
mixed
addRecursive( string $name , mixed $value )
Recursively add data.
$name
$value
contentType( )
Get the content type for this payload.
If this object contains files, multipart/form-data
will be used, otherwise application/x-www-form-urlencoded
will be used.
string
count( )
Returns the count of parts inside this object.
integer
Countable::count()
hasFile( )
Check whether or not the current payload has any files.
boolean
isMultipart( )
Check whether or not the current payload is multipart.
A payload will become multipart when you add files or use add() with a Part instance.
boolean
newPart( string $name , string $value )
Method for creating new instances of Part
$name
$value
Cake\Network\Http\FormData\Part
© 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.html