PHP Class AppserverIo\Appserver\ServletEngine\Http\Part

Inheritance: implements AppserverIo\Psr\HttpMessage\PartInterface
Mostrar archivo Open project: appserver-io/appserver Class Usage Examples

Protected Properties

Property Type Description
$filename string Hold the orig filename given in multipart header
$headers array Holds the header information as array
$inputStream Holds input stream file pointer
$name string The name of the part
$size integer Holds the number of bytes written to inputStream
$tmpFilename string Hold the templary filename.

Public Methods

Method Description
addHeader ( string $name, string $value ) : void Adds header information to the part
delete ( ) : void Deletes the underlying storage for a file item, including deleting any associated temporary disk file.
fromHttpRequest ( AppserverIo\Psr\HttpMessage\PartInterface $httpPart ) : Part Creates a new servlet part instance with the data from the HTTP part.
getContentType ( ) : string Gets the content type of this part.
getFilename ( ) : string Gets the original form filename.
getHeader ( string $name ) : string Returns the value of the specified mime header as a String.
getHeaderNames ( ) : array Gets the header names of this Part.
getHeaders ( string $name = null ) : array Gets the values of the Part header with the given name.
getInputStream ( ) : resource Gets the content of this part as an InputStream
getName ( ) : string Gets the name of this part
getSize ( ) : integer Returns the size of this file.
getTmpFilename ( ) : string Returns the temporary filename.
init ( string $streamWrapper = self::STREAM_WRAPPER_TEMP, integer $maxMemory = 5242880 ) : void Initiates a http form part object
putContent ( string $content ) : void Puts content to input stream.
setFilename ( string $filename ) : void Sets the orig form filename.
setName ( string $name ) : void Sets the name of the part
setTmpFilename ( string $tmpFilename ) : void Sets the temporary filename.
write ( string $fileName ) : integer A convenience method to write this uploaded item to disk.

Method Details

addHeader() public method

Adds header information to the part
public addHeader ( string $name, string $value ) : void
$name string The header name
$value string The header value for given name
return void

delete() public method

Deletes the underlying storage for a file item, including deleting any associated temporary disk file.
public delete ( ) : void
return void

fromHttpRequest() public static method

Creates a new servlet part instance with the data from the HTTP part.
public static fromHttpRequest ( AppserverIo\Psr\HttpMessage\PartInterface $httpPart ) : Part
$httpPart AppserverIo\Psr\HttpMessage\PartInterface The HTTP part we want to copy
return Part The initialized servlet part

getContentType() public method

Gets the content type of this part.
public getContentType ( ) : string
return string The content type of this part.

getFilename() public method

Gets the original form filename.
public getFilename ( ) : string
return string The file's name

getHeader() public method

If the Part did not include a header of the specified name, this method returns null. If there are multiple headers with the same name, this method returns the first header in the part. The header name is case insensitive. You can use this method with any request header.
public getHeader ( string $name ) : string
$name string a String specifying the header name
return string The headers value for given name

getHeaderNames() public method

Gets the header names of this Part.
public getHeaderNames ( ) : array
return array

getHeaders() public method

Gets the values of the Part header with the given name.
public getHeaders ( string $name = null ) : array
$name string the header name whose values to return
return array

getInputStream() public method

Gets the content of this part as an InputStream
public getInputStream ( ) : resource
return resource The content of this part as an InputStream

getName() public method

Gets the name of this part
public getName ( ) : string
return string The name of this part as a String

getSize() public method

Returns the size of this file.
public getSize ( ) : integer
return integer The size of this part, in bytes.

getTmpFilename() public method

Returns the temporary filename.
public getTmpFilename ( ) : string
return string The temporary filename

init() public method

Initiates a http form part object
public init ( string $streamWrapper = self::STREAM_WRAPPER_TEMP, integer $maxMemory = 5242880 ) : void
$streamWrapper string The stream wrapper to use per default temp stream wrapper
$maxMemory integer Maximum memory in bytes per default to 5 MB
return void

putContent() public method

Puts content to input stream.
public putContent ( string $content ) : void
$content string The content as string
return void

setFilename() public method

Sets the orig form filename.
public setFilename ( string $filename ) : void
$filename string The file's name
return void

setName() public method

Sets the name of the part
public setName ( string $name ) : void
$name string The part's name
return void

setTmpFilename() public method

Sets the temporary filename.
public setTmpFilename ( string $tmpFilename ) : void
$tmpFilename string The temporary filename
return void

write() public method

A convenience method to write this uploaded item to disk.
public write ( string $fileName ) : integer
$fileName string The name of the file to which the stream will be written.
return integer

Property Details

$filename protected_oe property

Hold the orig filename given in multipart header
protected string $filename
return string

$headers protected_oe property

Holds the header information as array
protected array $headers
return array

$inputStream protected_oe property

Holds input stream file pointer
protected $inputStream

$name protected_oe property

The name of the part
protected string $name
return string

$size protected_oe property

Holds the number of bytes written to inputStream
protected int $size
return integer

$tmpFilename protected_oe property

Hold the templary filename.
protected string $tmpFilename
return string