- craft\web\UploadedFile » yii\web\UploadedFile » yii\base\BaseObject
UploadedFile represents the information for an uploaded file.
|$baseName||string – Original file base name|
|$error||integer – An error code describing the status of this file uploading.|
|$extension||string – File extension|
|$hasError||boolean – Whether there is an error with the uploaded file.|
|$name||string – The original name of the file being uploaded|
|$size||integer – The actual size of the uploaded file in bytes|
|$tempName||string – The path of the uploaded file on the server.|
|$type||string – The MIME-type of the uploaded file (such as "image/gif").|
|__call()||Calls the named method which is not a class method.|
|__get()||Returns the value of an object property.|
|__isset()||Checks if a property is set, i.e. defined and not null.|
|__set()||Sets value of an object property.|
|__unset()||Sets an object property to null.|
|canGetProperty()||Returns a value indicating whether a property can be read.|
|canSetProperty()||Returns a value indicating whether a property can be set.|
|className()||Returns the fully qualified name of this class.|
|getInstance()||Returns an uploaded file for the given model attribute.|
|getInstanceByName()||Returns an instance of the specified uploaded file. The name can be a plain string or a string like an array element (e.g. 'Post[imageFile]', or 'Post[imageFile]').|
|getInstances()||Returns all uploaded files for the given model attribute.|
|getInstancesByName()||Returns an array of instances starting with specified array name.|
|hasMethod()||Returns a value indicating whether a method is defined.|
|hasProperty()||Returns a value indicating whether a property is defined.|
|init()||Initializes the object.|
|reset()||Cleans up the loaded UploadedFile instances.|
|saveAs()||Saves the uploaded file.|
|saveAsTempFile()||Saves the uploaded file to a temp location.|
Returns an instance of the specified uploaded file. The name can be a plain string or a string like an array element (e.g. 'Post[imageFile]', or 'Post[imageFile]').
static, null – The instance of the uploaded file. null is returned if no file is uploaded for the
public static static, null getInstanceByName ( $name, \craft\web\bool $ensureTempFileExists = true )
Returns an array of instances starting with specified array name. If multiple files were uploaded and saved as 'Files', 'Files', 'Files[n]'..., you can have them all by passing 'Files' as array name.
craft\web\UploadedFile – The array of UploadedFile objects. Empty array is returned if no adequate upload was found. Please note that this array will contain all files from all subarrays regardless how deeply nested they are.
public static craft\web\UploadedFile getInstancesByName ( $name, $lookForSingleInstance = true, $ensureTempFilesExist = true )
Saves the uploaded file to a temp location.
$deleteTempFile(boolean) – Whether to delete the temporary file after saving. If true, you will not be able to save the uploaded file again in the current request.
public string, false saveAsTempFile ( \craft\web\bool $deleteTempFile = true )