class UploadedFile 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

Methods

string
path()

Get the fully-qualified path to the file.

string
extension()

Get the file's extension.

string
hashName(string|null $path = null)

Get a filename for the file.

array|null
dimensions()

Get the dimensions of the image (if applicable).

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

static FileFactory
fake()

Begin creating a new file fake.

string|false
store(string $path = '', array|string $options = [])

Store the uploaded file on a filesystem disk.

string|false
storePublicly(string $path = '', array|string $options = [])

Store the uploaded file on a filesystem disk with public visibility.

string|false
storePubliclyAs(string $path, array|string|null $name = null, array|string $options = [])

Store the uploaded file on a filesystem disk with public visibility.

string|false
storeAs(string $path, array|string|null $name = null, array|string $options = [])

Store the uploaded file on a filesystem disk.

string|false
get()

Get the contents of the uploaded file.

string
clientExtension()

Get the file's extension supplied by the client.

static UploadedFile
createFromBase(UploadedFile $file, bool $test = false)

Create a new file instance from a base instance.

array
parseOptions(array|string $options)

Parse and format the given options.

static void
flushState()

Flush all static state.

Details

in FileHelpers at line 19
string path()

Get the fully-qualified path to the file.

Return Value

string

in FileHelpers at line 27
string extension()

Get the file's extension.

Return Value

string

in FileHelpers at line 35
string hashName(string|null $path = null)

Get a filename for the file.

Parameters

string|null $path

Return Value

string

in FileHelpers at line 53
array|null dimensions()

Get the dimensions of the image (if applicable).

Return Value

array|null

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.

Parameters

string $name
callable|object $macro

Return Value

void

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.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

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.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 103
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 23
static FileFactory fake()

Begin creating a new file fake.

Return Value

FileFactory

at line 31
string|false store(string $path = '', array|string $options = [])

Store the uploaded file on a filesystem disk.

Parameters

string $path
array|string $options

Return Value

string|false

at line 39
string|false storePublicly(string $path = '', array|string $options = [])

Store the uploaded file on a filesystem disk with public visibility.

Parameters

string $path
array|string $options

Return Value

string|false

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.

Parameters

string $path
array|string|null $name
array|string $options

Return Value

string|false

at line 67
string|false storeAs(string $path, array|string|null $name = null, array|string $options = [])

Store the uploaded file on a filesystem disk.

Parameters

string $path
array|string|null $name
array|string $options

Return Value

string|false

at line 90
string|false get()

Get the contents of the uploaded file.

Return Value

string|false

Exceptions

FileNotFoundException

at line 102
string clientExtension()

Get the file's extension supplied by the client.

Return Value

string

at line 110
static UploadedFile createFromBase(UploadedFile $file, bool $test = false)

Create a new file instance from a base instance.

Parameters

UploadedFile $file
bool $test

Return Value

UploadedFile

at line 124
protected array parseOptions(array|string $options)

Parse and format the given options.

Parameters

array|string $options

Return Value

array

at line 136
static void flushState()

Flush all static state.

Return Value

void