File
class File extends UploadedFile
Traits
Properties
| protected string|null | $hashName | The cache copy of the file's hash name. |
from FileHelpers |
| static protected array | $macros | The registered string macros. |
from Macroable |
| string | $name | The name of the file. |
|
| resource | $tempFile | The temporary file resource. |
|
| int|null | $sizeToReport | The "size" to report. |
|
| string|null | $mimeTypeToReport | The MIME type to report. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Store the uploaded file on a filesystem disk.
Store the uploaded file on a filesystem disk with public visibility.
Store the uploaded file on a filesystem disk with public visibility.
Store the uploaded file on a filesystem disk.
Create a new file instance from a base instance.
Create a new file instance.
Create a new fake file with content.
Get the size of the file.
Get the MIME type of the file.
Get the path to the temporary file.
Details
in
FileHelpers at line 19
string
path()
Get the fully-qualified path to the file.
in
FileHelpers at line 27
string
extension()
Get the file's extension.
in
FileHelpers at line 35
string
hashName(string|null $path = null)
Get a filename for the file.
in
FileHelpers at line 53
array|null
dimensions()
Get the dimensions of the image (if applicable).
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
UploadedFile at line 23
static FileFactory
fake()
Begin creating a new file fake.
in
UploadedFile at line 31
string|false
store(string $path = '', array|string $options = [])
Store the uploaded file on a filesystem disk.
in
UploadedFile at line 39
string|false
storePublicly(string $path = '', array|string $options = [])
Store the uploaded file on a filesystem disk with public visibility.
in
UploadedFile at line 51
string|false
storePubliclyAs(string $path, array|string|null $name = null, array|string $options = [])
Store the uploaded file on a filesystem disk with public visibility.
in
UploadedFile at line 67
string|false
storeAs(string $path, array|string|null $name = null, array|string $options = [])
Store the uploaded file on a filesystem disk.
in
UploadedFile at line 90
string|false
get()
Get the contents of the uploaded file.
in
UploadedFile at line 102
string
clientExtension()
Get the file's extension supplied by the client.
in
UploadedFile at line 110
static UploadedFile
createFromBase(UploadedFile $file, bool $test = false)
Create a new file instance from a base instance.
in
UploadedFile at line 124
protected array
parseOptions(array|string $options)
Parse and format the given options.
in
UploadedFile at line 136
static void
flushState()
Flush all static state.
at line 38
__construct(string $name, mixed $tempFile)
Create a new file instance.
at line 55
static File
create(string $name, string|int $kilobytes = 0)
Create a new fake file.
at line 63
static File
createWithContent(string $name, string $content)
Create a new fake file with content.
at line 71
static File
image(string $name, int $width = 10, int $height = 10)
Create a new fake image.
at line 79
File
size(int $kilobytes)
Set the "size" of the file in kilobytes.
at line 89
int
getSize()
Get the size of the file.
at line 97
File
mimeType(string $mimeType)
Set the MIME type for the file.
at line 107
string
getMimeType()
Get the MIME type of the file.
at line 115
protected string
tempFilePath()
Get the path to the temporary file.