Class UploadedFile
Value object representing a file uploaded through an HTTP request.
Instances of this interface are considered immutable; all methods that
might change state MUST be implemented such that they retain the internal
state of the current instance and return an instance that contains the
changed state.
-
GuzzleHttp\Psr7\UploadedFile
implements
Psr\Http\Message\UploadedFileInterface
Methods summary
public
|
#
__construct( Psr\Http\Message\StreamInterface |string|resource $streamOrFile, integer $size, integer $errorStatus, string|null $clientFilename = null, string|null $clientMediaType = null )
Parameters
- $streamOrFile
- $size
- $errorStatus
- $clientFilename
- $clientMediaType
|
public
boolean
|
|
public
Psr\Http\Message\StreamInterface
|
#
getStream( )
Retrieve a stream representing the uploaded file.
Retrieve a stream representing the uploaded file.
Returns
Throws
RuntimeException if the upload was not successful.
Implementation of
|
public
|
#
moveTo( string $targetPath )
Move the uploaded file to a new location.
Move the uploaded file to a new location.
Parameters
- $targetPath
- Path to which to move the uploaded file.
Throws
RuntimeException if the upload was not successful.
InvalidArgumentException if the $path specified is invalid.
RuntimeException on any error during the move operation, or on
the second or subsequent call to the method.
See
http://php.net/is_uploaded_file
http://php.net/move_uploaded_file
Implementation of
|
public
integer|null
|
#
getSize( )
Retrieve the file size.
Returns
integer|null The file size in bytes or null if unknown.
Implementation of
|
public
integer
|
#
getError( )
Retrieve the error associated with the uploaded file.
Retrieve the error associated with the uploaded file.
Returns
integer One of PHP's UPLOAD_ERR_XXX constants.
See
http://php.net/manual/en/features.file-upload.errors.php
Implementation of
|
public
string|null
|
#
getClientFilename( )
Retrieve the filename sent by the client.
Retrieve the filename sent by the client.
Returns
string|null The filename sent by the client or null if none
was provided.
Implementation of
|
public
string|null
|
#
getClientMediaType( )
Retrieve the media type sent by the client.
Retrieve the media type sent by the client.
Returns
string|null The media type sent by the client or null if none
was provided.
Implementation of
|