CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 4.6 Strawberry API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 4.6
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
        • Exception
      • Cookie
      • Exception
      • Middleware
      • Session
      • TestSuite
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

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.

Namespace: Cake\Http\Client

Property Summary

  • $_charset protected
    string|null

    The charset attribute for the Content-Disposition header fields

  • $_contentId protected
    string|null

    The contentId for the part

  • $_disposition protected
    string

    Disposition to send

  • $_filename protected
    string|null

    Filename to send if using files.

  • $_name protected
    string

    Name of the value.

  • $_transferEncoding protected
    string|null

    The encoding used in this part.

  • $_type protected
    string|null

    Content type to use

  • $_value protected
    string

    Value to send.

Method Summary

  • __construct() public

    Constructor

  • __toString() public

    Convert the part into a string.

  • _headerParameterToString() protected

    Get the string for the header parameter.

  • contentId() public

    Get/set the contentId for a part.

  • disposition() public

    Get/set the disposition type

  • filename() public

    Get/set the filename.

  • name() public

    Get the part name.

  • transferEncoding() public

    Set the transfer-encoding for multipart.

  • type() public

    Get/set the content type.

  • value() public

    Get 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(): string

Convert the part into a string.

Creates a string suitable for use in HTTP requests.

Returns
string

_headerParameterToString() ¶ protected

_headerParameterToString(string $name, string $value): string

Get 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
string

contentId() ¶ public

contentId(string|null $id = null): string|null

Get/set the contentId for a part.

Parameters
string|null $id optional

The content id.

Returns
string|null

disposition() ¶ public

disposition(string|null $disposition = null): string

Get/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

filename() ¶ public

filename(string|null $filename = null): string|null

Get/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|null

name() ¶ public

name(): string

Get the part name.

Returns
string

transferEncoding() ¶ public

transferEncoding(string|null $type): string|null

Set 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|null

type() ¶ public

type(string|null $type): string|null

Get/set the content type.

Parameters
string|null $type

Use null to get/string to set.

Returns
string|null

value() ¶ public

value(): string

Get the value.

Returns
string

Property Detail

$_charset ¶ protected

The charset attribute for the Content-Disposition header fields

Type
string|null

$_contentId ¶ protected

The contentId for the part

Type
string|null

$_disposition ¶ protected

Disposition to send

Type
string

$_filename ¶ protected

Filename to send if using files.

Type
string|null

$_name ¶ protected

Name of the value.

Type
string

$_transferEncoding ¶ protected

The encoding used in this part.

Type
string|null

$_type ¶ protected

Content type to use

Type
string|null

$_value ¶ protected

Value to send.

Type
string
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs