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
$error
The file uploading error
protected
int
$error
$fileName
The file name
protected
string
$fileName
$fileSize
The file size
protected
int
$fileSize
$tempPath
The file temp path
protected
string
$tempPath
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
stringgetBaseName()
Get the file basename
public
getBaseName() : string
Return values
stringgetError()
Get the upload error
public
getError() : int
Return values
intgetExtension()
Get the file extension
public
getExtension() : string
Return values
stringgetFileName()
Get the file name
public
getFileName() : string
Return values
stringgetFileSize()
Get the file size
public
getFileSize() : number
Return values
numbergetMimeType()
Get the file mime type
public
getMimeType() : string
Return values
stringgetSplFileInfo()
Get SplFileInfo object for this file
public
getSplFileInfo() : SplFileInfo
Return values
SplFileInfogetTempPath()
Get temporarily path to file
public
getTempPath() : string
Return values
stringgetType()
Get the type of the file from its mimetype
public
getType() : string
return string
Return values
stringloadFiles()
Load file from input $name
public
static loadFiles(string $name) : UploadedFile|array<string|int, UploadedFile>|null
Parameters
- $name : string
Return values
UploadedFile|array<string|int, UploadedFile>|nullmoveTo()
Move the file to $path
public
moveTo(string $path) : bool
Parameters
- $path : string
Return values
boolvalidate()
Validate the input file is respecting upload restrictions This function throws exception in case of error
public
validate() : void
Tags
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