UploadedFile
class UploadedFile extends FileInfo
Uploaded file.
Properties
protected string | $filename | Filename. | |
protected int | $size | File size. | |
protected string | $type | File mime type. | |
protected int | $errorCode | File error code. |
Methods
Generates a hash using the contents of the file.
Returns TRUE if the file matches the provided hash and FALSE if not.
Generates a HMAC using the contents of the file.
Returns TRUE if the file matches the provided HMAC and FALSE if not.
Constuctor.
Returns the filename reported by the client.
Returns the size reported by the client in bytes.
Returns the mime type reported by the client.
Does the file have an error?
Returns the file error code.
Returns a human friendly error message.
Returns TRUE if the file has been uploaded and FALSE if not.
Moves the file to the desired path.
Moves the file to the desired path.
Details
in FileInfo at line 29
string|null
getMimeType()
Returns the MIME type of the file.
in FileInfo at line 45
string|null
getMimeEncoding()
Returns the MIME encoding of the file.
in FileInfo at line 63
string
getHash(string $algorithm = 'sha256', bool $raw = false)
Generates a hash using the contents of the file.
in FileInfo at line 76
bool
validateHash(string $hash, string $algorithm = 'sha256', bool $raw = false)
Returns TRUE if the file matches the provided hash and FALSE if not.
in FileInfo at line 89
string
getHmac(string $key, string $algorithm = 'sha256', bool $raw = false)
Generates a HMAC using the contents of the file.
in FileInfo at line 103
bool
validateHmac(string $hmac, string $key, string $algorithm = 'sha256', bool $raw = false)
Returns TRUE if the file matches the provided HMAC and FALSE if not.
at line 59
__construct(string $path, string $name, int $size, string $type, int $errorCode)
Constuctor.
at line 77
string
getReportedFilename()
Returns the filename reported by the client.
at line 87
int
getReportedSize()
Returns the size reported by the client in bytes.
at line 97
string
getReportedMimeType()
Returns the mime type reported by the client.
at line 107
bool
hasError()
Does the file have an error?
at line 117
int
getErrorCode()
Returns the file error code.
at line 127
string
getErrorMessage()
Returns a human friendly error message.
at line 157
bool
isUploaded()
Returns TRUE if the file has been uploaded and FALSE if not.
at line 168
protected bool
moveUploadedFile(string $path)
Moves the file to the desired path.
at line 179
bool
moveTo(string $path)
Moves the file to the desired path.