Orpheus

UploadedFile
in package

Class representing a http uploaded file

Table of Contents

Properties

$allowedExtensions  : array<string|int, mixed>|null
Allowed extension to upload
$allowedMimeTypes  : array<string|int, mixed>|null
Allowed mime types to upload
$expectedType  : string|null
Allowed type to upload
$error  : int
The file uploading error
$fileName  : string
The file name
$fileSize  : int
The file size
$tempPath  : string
The file temp path

Methods

__construct()  : mixed
Constructor
__toString()  : string
Get the uploaded file (file name) as string
getBaseName()  : string
Get the file basename
getError()  : int
Get the upload error
getExtension()  : string
Get the file extension
getFileName()  : string
Get the file name
getFileSize()  : number
Get the file size
getMimeType()  : string
Get the file mime type
getSplFileInfo()  : SplFileInfo
Get SplFileInfo object for this file
getTempPath()  : string
Get temporarily path to file
getType()  : string
Get the type of the file from its mimetype
loadFiles()  : UploadedFile|array<string|int, UploadedFile>|null
Load file from input $name
moveTo()  : bool
Move the file to $path
validate()  : void
Validate the input file is respecting upload restrictions This function throws exception in case of error
loadInputFiles()  : array<string|int, UploadedFile>
Get uploaded file from path

Properties

$allowedExtensions

Allowed extension to upload

public array<string|int, mixed>|null $allowedExtensions = null

$allowedMimeTypes

Allowed mime types to upload

public array<string|int, mixed>|null $allowedMimeTypes = null

$expectedType

Allowed type to upload

public string|null $expectedType = null

Methods

__construct()

Constructor

public __construct(string $tempPath, string $fileName, int $fileSize, int $error) : mixed
Parameters
$tempPath : string
$fileName : string
$fileSize : int
$error : int

__toString()

Get the uploaded file (file name) as string

public __toString() : string
Return values
string

getBaseName()

Get the file basename

public getBaseName() : string
Return values
string

getError()

Get the upload error

public getError() : int
Return values
int

getExtension()

Get the file extension

public getExtension() : string
Return values
string

getFileName()

Get the file name

public getFileName() : string
Return values
string

getFileSize()

Get the file size

public getFileSize() : number
Return values
number

getMimeType()

Get the file mime type

public getMimeType() : string
Return values
string

getSplFileInfo()

Get SplFileInfo object for this file

public getSplFileInfo() : SplFileInfo
Return values
SplFileInfo

getTempPath()

Get temporarily path to file

public getTempPath() : string
Return values
string

getType()

Get the type of the file from its mimetype

public getType() : string

return string

Return values
string

moveTo()

Move the file to $path

public moveTo(string $path) : bool
Parameters
$path : string
Return values
bool

validate()

Validate the input file is respecting upload restrictions This function throws exception in case of error

public validate() : void
Tags
throws
UserException

loadInputFiles()

Get uploaded file from path

protected static loadInputFiles(array<string|int, mixed> $input[, array<string|int, mixed> &$files = [] ][, string|null $path = null ]) : array<string|int, UploadedFile>
Parameters
$input : array<string|int, mixed>
$files : array<string|int, mixed> = []
$path : string|null = null
Return values
array<string|int, UploadedFile>

							
On this page

Search results