PHP Class AppserverIo\Appserver\ServletEngine\Http\Part

Inheritance: implements AppserverIo\Psr\HttpMessage\PartInterface
Afficher le fichier Open project: appserver-io/appserver Class Usage Examples

Protected Properties

Свойство 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.

Méthodes publiques

Méthode 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 méthode

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
Résultat void

delete() public méthode

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

fromHttpRequest() public static méthode

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
Résultat Part The initialized servlet part

getContentType() public méthode

Gets the content type of this part.
public getContentType ( ) : string
Résultat string The content type of this part.

getFilename() public méthode

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

getHeader() public méthode

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
Résultat string The headers value for given name

getHeaderNames() public méthode

Gets the header names of this Part.
public getHeaderNames ( ) : array
Résultat array

getHeaders() public méthode

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
Résultat array

getInputStream() public méthode

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

getName() public méthode

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

getSize() public méthode

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

getTmpFilename() public méthode

Returns the temporary filename.
public getTmpFilename ( ) : string
Résultat string The temporary filename

init() public méthode

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
Résultat void

putContent() public méthode

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

setFilename() public méthode

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

setName() public méthode

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

setTmpFilename() public méthode

Sets the temporary filename.
public setTmpFilename ( string $tmpFilename ) : void
$tmpFilename string The temporary filename
Résultat void

write() public méthode

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.
Résultat integer

Property Details

$filename protected_oe property

Hold the orig filename given in multipart header
protected string $filename
Résultat string

$headers protected_oe property

Holds the header information as array
protected array $headers
Résultat array

$inputStream protected_oe property

Holds input stream file pointer
protected $inputStream

$name protected_oe property

The name of the part
protected string $name
Résultat string

$size protected_oe property

Holds the number of bytes written to inputStream
protected int $size
Résultat integer

$tmpFilename protected_oe property

Hold the templary filename.
protected string $tmpFilename
Résultat string