Copied!
Cloneable Instantiable
Implements Psr\Http\Message\UploadedFileInterface
Methods
public __construct ( $streamOrFile , $size , $errorStatus , $clientFilename = NULL , $clientMediaType = NULL )
 
public getClientFilename ()
 

{@inheritdoc}

  • return string | null The filename sent by the client or null if none was provided.
public getClientMediaType ()
 

{@inheritdoc}

public getError ()
 

{@inheritdoc}

  • see http://php.net/manual/en/features.file-upload.errors.php
  • return int One of PHP's UPLOAD_ERR_XXX constants.
public getSize ()
 

{@inheritdoc}

  • return int | null The file size in bytes or null if unknown.
public getStream ()
 

{@inheritdoc}

  • throws RuntimeException if the upload was not successful.
public isMoved ()
 
  • return bool
public moveTo ( $targetPath )
 

{@inheritdoc}

  • see http://php.net/is_uploaded_file
  • see http://php.net/move_uploaded_file
  • throws RuntimeException if the upload was not successful.
  • throws InvalidArgumentException if the $path specified is invalid.
  • throws RuntimeException on any error during the move operation, or on the second or subsequent call to the method.
Properties
private $clientFilename
 
  • var string
private $clientMediaType
 
  • var string
private $error
 
  • var int
private static $errors = [ 0 , 1 , 2 , 3 , 4 , 6 , 7 , 8 ]
 
  • var int []
private $file
 
  • var null | string
private $moved
 
  • var bool
private $size
 
  • var int
private $stream
 
  • var StreamInterface | null
Methods
private isOk ()
 

Return true if there is no upload error

  • return bool
private isStringNotEmpty ( $param )
 
  • return bool
private isStringOrNull ( $param )
 
  • return bool
private setClientFilename ( $clientFilename )
 
  • throws InvalidArgumentException
private setClientMediaType ( $clientMediaType )
 
  • throws InvalidArgumentException
private setError ( $error )
 
  • throws InvalidArgumentException
private setSize ( $size )
 
  • throws InvalidArgumentException
private setStreamOrFile ( $streamOrFile )
 

Depending on the value set file or stream variable

  • throws InvalidArgumentException
private validateActive ()
 
  • throws RuntimeException if is moved or not ok
Properties
private static $errors = [ 0 , 1 , 2 , 3 , 4 , 6 , 7 , 8 ]
 
  • var int []
© 2020 Bruce Wells
Search Namespaces \ Classes
Configuration Numbers (0-9.) only