Property | Type | Description | |
---|---|---|---|
$attribute | the attribute which holds the attachment. | ||
$deleteTempFile | boolean | whether to delete the temporary file after saving. | |
$generateNewName | generate a new unique name for the file set true or anonymous function takes the old filename and returns a new name. | ||
$instanceByName | Getting file instance by name | ||
$path | the base path or path alias to the directory in which to save files. | ||
$scenarios | the scenarios in which the behavior will be triggered | ||
$unlinkOnDelete | If true current attribute file will be deleted after model deletion. | ||
$unlinkOnSave | If true current attribute file will be deleted | ||
$url | the base URL or path alias for this file |
Method | Description | |
---|---|---|
afterDelete ( ) | This method is invoked after deleting a record. | |
afterSave ( ) | This method is called at the end of inserting or updating a record. | |
beforeSave ( ) | This method is called at the beginning of inserting or updating a record. | |
beforeValidate ( ) | This method is invoked before validation starts. | |
events ( ) | ||
getUploadPath ( string $attribute, boolean $old = false ) : string | null | Returns file path for the attribute. | |
getUploadUrl ( string $attribute ) : string | null | Returns file url for the attribute. | |
init ( ) | ||
sanitize ( string $filename ) : boolean | Replaces characters in strings that are illegal/unsafe for filename. |
Method | Description | |
---|---|---|
afterUpload ( ) | This method is invoked after uploading a file. | |
delete ( string $attribute, boolean $old = false ) | Deletes old file. | |
generateFileName ( |
Generates random filename. | |
getFileName ( |
||
resolvePath ( $path ) | Replaces all placeholders in path variable with corresponding values. | |
save ( |
Saves the uploaded file. |
public afterSave ( ) |
protected afterUpload ( ) |
public beforeSave ( ) |
public beforeValidate ( ) |
protected generateFileName ( |
||
$file | ||
return | string |
protected getFileName ( |
||
$file | ||
return | string |
protected resolvePath ( $path ) |
public bool $deleteTempFile | ||
return | boolean |
public $generateNewName |
public $path |
public $scenarios |
public $unlinkOnDelete |
public $unlinkOnSave |