XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | List of all members
HTTP_Request2_MultipartBody Class Reference

Public Member Functions

 __construct (array $params, array $uploads, $useBrackets=true)
 
 getLength ()
 
 getBoundary ()
 
 read ($length)
 
 rewind ()
 
 __toString ()
 

Detailed Description

Definition at line 38 of file MultipartBody.php.

Constructor & Destructor Documentation

HTTP_Request2_MultipartBody::__construct ( array  $params,
array  $uploads,
  $useBrackets = true 
)

Constructor. Sets the arrays with POST data.

Parameters
array$paramsvalues of form fields set via HTTP_Request2::addPostParameter()
array$uploadsfile uploads set via HTTP_Request2::addUpload()
bool$useBracketswhether to append brackets to array variable names

Definition at line 90 of file MultipartBody.php.

Member Function Documentation

HTTP_Request2_MultipartBody::__toString ( )

Returns the body as string

Note that it reads all file uploads into memory so it is a good idea not to use this method with large file uploads and rely on read() instead.

Returns
string

Definition at line 231 of file MultipartBody.php.

HTTP_Request2_MultipartBody::getBoundary ( )

Returns the boundary to use in Content-Type header

Returns
string

Definition at line 136 of file MultipartBody.php.

HTTP_Request2_MultipartBody::getLength ( )

Returns the length of the body to use in Content-Length header

Returns
integer

Definition at line 115 of file MultipartBody.php.

HTTP_Request2_MultipartBody::read (   $length)

Returns next chunk of request body

Parameters
integer$lengthNumber of bytes to read
Returns
string Up to $length bytes of data, empty string if at end
Exceptions
HTTP_Request2_LogicException

Definition at line 152 of file MultipartBody.php.

HTTP_Request2_MultipartBody::rewind ( )

Sets the current position to the start of the body

This allows reusing the same body in another request

Definition at line 215 of file MultipartBody.php.


The documentation for this class was generated from the following file: