Methods |
public
|
__construct(string $path, bool $checkFile = false)
Run our SplFileInfo constructor with an optional verification
that the path is really a file.
Run our SplFileInfo constructor with an optional verification
that the path is really a file.
Throws
Overrides
Overriden by
|
#
|
public
|
getSize(): false|int
Retrieve the file size.
Retrieve the file size.
Implementations SHOULD return the value stored in the "size" key of
the file in the $_FILES array if available, as PHP calculates this based
on the actual size transmitted.
Returns
The file size in bytes, or false on failure
Overrides
|
#
|
public
|
getSizeByUnit(string $unit = 'b'): false|int|string
Retrieve the file size by unit.
Retrieve the file size by unit.
|
#
|
public
|
guessExtension(): ?string
Attempts to determine the file extension based on the trusted
getType() method. If the mime type is unknown, will…
Attempts to determine the file extension based on the trusted
getType() method. If the mime type is unknown, will return null.
Overriden by
|
#
|
public
|
getMimeType(): string
Retrieve the media type of the file. SHOULD not use information from
the $_FILES array, but should use other methods to…
Retrieve the media type of the file. SHOULD not use information from
the $_FILES array, but should use other methods to more accurately
determine the type of file, like finfo, or mime_content_type().
Returns
The media type we determined it to be.
|
#
|
public
|
getRandomName(): string
Generates a random names based on a simple hash and the time, with
the correct file extension attached.
Generates a random names based on a simple hash and the time, with
the correct file extension attached.
|
#
|
public
|
move(string $targetPath, ?string $name = null, bool $overwrite = false): File
Moves a file to a new location.
Moves a file to a new location.
Overriden by
|
#
|
public
|
getDestination(string $destination, string $delimiter = '_', int $i = 0): string
Returns the destination path for the move operation where overwriting is not expected.
Returns the destination path for the move operation where overwriting is not expected.
First, it checks whether the delimiter is present in the filename, if it is, then it checks whether the
last element is an integer as there may be cases that the delimiter may be present in the filename.
For the all other cases, it appends an integer starting from zero before the file's extension.
|
#
|