CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 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

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • CookieCollection
  • FormData
  • Message
  • Request
  • Response

Interfaces

  • AdapterInterface

Class FormData

Provides an interface for building multipart/form-encoded message bodies.

Used by Http\Client to upload POST/PUT data and files.

Cake\Http\Client\FormData implements Countable
Namespace: Cake\Http\Client
Location: Http/Client/FormData.php

Properties summary

  • $_boundary protected
    string
    Boundary marker.
  • $_hasComplexPart protected
    boolean
    Whether or not this formdata object has a complex part.
  • $_hasFile protected
    boolean
    Whether or not this formdata object has attached files.
  • $_parts protected
    Cake\Http\Client\FormDataPart[]
    The parts in the form data.

Method Summary

  • __toString() public

    Converts the FormData and its parts into a string suitable for use in an HTTP request.

  • add() public
    Add a new part to the data.
  • addFile() public

    Add either a file reference (string starting with @) or a file handle.

  • addMany() public
    Add multiple parts at once.
  • addRecursive() public
    Recursively add data.
  • boundary() public
    Get the boundary marker
  • contentType() public
    Get the content type for this payload.
  • count() public
    Returns the count of parts inside this object.
  • hasFile() public

    Check whether or not the current payload has any files.

  • isMultipart() public

    Check whether or not the current payload is multipart.

  • newPart() public
    Method for creating new instances of Part

Method Detail

__toString() public ¶

__toString( )

Converts the FormData and its parts into a string suitable for use in an HTTP request.

Returns
string

add() public ¶

add( string|Cake\Http\Client\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.

Parameters
string|Cake\Http\Client\FormData $name

The name of the part to add, or the part data object.

mixed $value optional null
The value for the part.
Returns

$this

addFile() public ¶

addFile( string $name , mixed $value )

Add either a file reference (string starting with @) or a file handle.

Parameters
string $name
The name to use.
mixed $value
Either a string filename, or a filehandle.
Returns
Cake\Http\Client\FormDataPart

addMany() public ¶

addMany( array $data )

Add multiple parts at once.

Iterates the parameter and adds all the key/values.

Parameters
array $data
Array of data to add.
Returns

$this

addRecursive() public ¶

addRecursive( string $name , mixed $value )

Recursively add data.

Parameters
string $name
The name to use.
mixed $value
The value to add.

boundary() public ¶

boundary( )

Get the boundary marker

Returns
string

contentType() public ¶

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.

Returns
string

count() public ¶

count( )

Returns the count of parts inside this object.

Returns
integer
Implementation of
Countable::count()

hasFile() public ¶

hasFile( )

Check whether or not the current payload has any files.

Returns
boolean
Whether or not there is a file in this payload.

isMultipart() public ¶

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.

Returns
boolean
Whether or not the payload is multipart.

newPart() public ¶

newPart( string $name , string $value )

Method for creating new instances of Part

Parameters
string $name
The name of the part.
string $value
The value to add.
Returns
Cake\Http\Client\FormDataPart

Properties detail

$_boundary ¶

protected string

Boundary marker.

$_hasComplexPart ¶

protected boolean

Whether or not this formdata object has a complex part.

false

$_hasFile ¶

protected boolean

Whether or not this formdata object has attached files.

false

$_parts ¶

protected Cake\Http\Client\FormDataPart[]

The parts in the form data.

[]
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs