Provides an interface for building multipart/form-encoded message bodies.
Used by Http\Client to upload POST/PUT data and files.
stringBoundary marker.
boolWhether this formdata object has a complex part.
boolWhether this formdata object has attached files.
arrayCake\Http\Client\FormDataPart>The parts in the form data.
Converts the FormData and its parts into a string suitable for use in an HTTP request.
Add a new part to the data.
Add either a file reference (string starting with @) or a file handle.
Add multiple parts at once.
Recursively add data.
Get the boundary marker
Get the content type for this payload.
Returns the count of parts inside this object.
Check whether the current payload has any files.
Check whether the current payload is multipart.
Method for creating new instances of Part
__toString(): string
Converts the FormData and its parts into a string suitable for use in an HTTP request.
stringadd(Cake\Http\Client\FormDataPart|string $name, mixed $value = null): $this
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\Http\Client\FormDataPart|string $name The name of the part to add, or the part data object.
mixed $value optional The value for the part.
$thisaddFile(string $name, string|resourcePsr\Http\Message\UploadedFileInterface $value): Cake\Http\Client\FormDataPart
Add either a file reference (string starting with @) or a file handle.
string $name The name to use.
string|resourcePsr\Http\Message\UploadedFileInterface $value Either a string filename, or a filehandle, or a UploadedFileInterface instance.
Cake\Http\Client\FormDataPartaddMany(array $data): $this
Add multiple parts at once.
Iterates the parameter and adds all the key/values.
array $data Array of data to add.
$thisaddRecursive(string $name, mixed $value): void
Recursively add data.
string $name The name to use.
mixed $value The value to add.
voidboundary(): string
Get the boundary marker
stringcontentType(): string
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.
stringcount(): int
Returns the count of parts inside this object.
inthasFile(): bool
Check whether the current payload has any files.
boolisMultipart(): bool
Check whether the current payload is multipart.
A payload will become multipart when you add files or use add() with a Part instance.
boolnewPart(string $name, string $value): Cake\Http\Client\FormDataPart
Method for creating new instances of Part
string $name The name of the part.
string $value The value to add.
Cake\Http\Client\FormDataPartBoundary marker.
stringWhether this formdata object has a complex part.
boolWhether this formdata object has attached files.
boolThe parts in the form data.
arrayCake\Http\Client\FormDataPart>
© 2005–present 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.
https://api.cakephp.org/4.4/class-Cake.Http.Client.FormData.html