Documentation

UploadedFile
in package

Represents an uploaded file

You can get an instance of this via the Request::uploadedFile() method.

Tags
see
Request

Table of Contents

$error  : int
$name  : string
$size  : int
$tempPath  : string
$type  : string
__construct()  : mixed
error()  : int
The upload error. If no error happened the value is UPLOAD_ERR_OK (0)
moveTo()  : bool
Moves the uploaded file to the given path, then sets the tempPath to ''
name()  : string
The original name of the uploaded file
size()  : int
The size of the uploaded file in bytes
tempPath()  : string
The temp path of the uploaded file
type()  : string
The mime type of the uploaded file
uploaded()  : bool
Tells whether the file was uploaded via HTTP POST

Properties

Methods

__construct()

public __construct(string $name, string $tempPath, int $error, string $type, int $size) : mixed
Parameters
$name : string
$tempPath : string
$error : int
$type : string
$size : int
Return values
mixed —

error()

The upload error. If no error happened the value is UPLOAD_ERR_OK (0)

public error() : int
Return values
int —

moveTo()

Moves the uploaded file to the given path, then sets the tempPath to ''

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

name()

The original name of the uploaded file

public name() : string
Return values
string —

size()

The size of the uploaded file in bytes

public size() : int
Return values
int —

tempPath()

The temp path of the uploaded file

public tempPath() : string
Return values
string —

type()

The mime type of the uploaded file

public type() : string

Important: do NOT trust this value, this is just set by the browser. If you need the real mime type, you should analyze the file for it!

Return values
string —

uploaded()

Tells whether the file was uploaded via HTTP POST

public uploaded() : bool
Return values
bool —

Search results