Class FormDataPart
Contains the data and behavior for a single part in a Multipart FormData request body.
Added to Cake\Http\Client\FormData when sending data to a remote server.
Property Summary
- 
        $_charset protectedstring|nullThe charset attribute for the Content-Disposition header fields 
- 
        $_contentId protectedstringThe contentId for the part 
- 
        $_disposition protectedstringDisposition to send 
- 
        $_filename protectedstringFilename to send if using files. 
- 
        $_name protectedstringName of the value. 
- 
        $_transferEncoding protectedstringThe encoding used in this part. 
- 
        $_type protectedstringContent type to use 
- 
        $_value protectedstringValue to send. 
Method Summary
- 
          __construct() publicConstructor 
- 
          __toString() publicConvert the part into a string. 
- 
          _headerParameterToString() protectedGet the string for the header parameter. 
- 
          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() ¶ public
__construct(string $name, string $value, string $disposition = 'form-data', string|null $charset = null)Constructor
Parameters
- 
                string$name
- The name of the data. 
- 
                string$value
- The value of the data. 
- 
                string$disposition optional
- The type of disposition to use, defaults to form-data. 
- 
                string|null$charset optional
- The charset of the data. 
__toString() ¶ public
__toString(): stringConvert the part into a string.
Creates a string suitable for use in HTTP requests.
Returns
string_headerParameterToString() ¶ protected
_headerParameterToString(string $name, string $value): stringGet the string for the header parameter.
If the value contains non-ASCII letters an additional header indicating the charset encoding will be set.
Parameters
- 
                string$name
- The name of the header parameter 
- 
                string$value
- The value of the header parameter 
Returns
stringcontentId() ¶ public
contentId(string|null $id = null): string|nullGet/set the contentId for a part.
Parameters
- 
                string|null$id optional
- The content id. 
Returns
string|nulldisposition() ¶ public
disposition(string|null $disposition = null): string|nullGet/set the disposition type
By passing in false you can disable the disposition
header from being added.
Parameters
- 
                string|null$disposition optional
- Use null to get/string to set. 
Returns
string|nullfilename() ¶ public
filename(string|null $filename = null): string|nullGet/set the filename.
Setting the filename to false will exclude it from the
generated output.
Parameters
- 
                string|null$filename optional
- Use null to get/string to set. 
Returns
string|nulltransferEncoding() ¶ public
transferEncoding(string|null $type): string|nullSet the transfer-encoding for multipart.
Useful when content bodies are in encodings like base64.
Parameters
- 
                string|null$type
- The type of encoding the value has. 
Returns
string|nulltype() ¶ public
type(string|null $type): string|nullGet/set the content type.
Parameters
- 
                string|null$type
- Use null to get/string to set. 
Returns
string|nullProperty Detail
$_charset ¶ protected
The charset attribute for the Content-Disposition header fields
Type
string|null