PHP Класс yupe\components\behaviors\FileUploadBehavior

Наследование: extends CActiveRecordBehavio\CActiveRecordBehavior
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$attributeName attribute to store name of the uploaded file.
$deleteFileKey string
$fileInstanceName the name of the file input field, used to get instance by name. Optional. If not set get instance by model attribute will be used.
$fileName callback function to generate filename. Optional. If not set, default implementation will be used.
$maxSize maximum file size.
$minSize minimum file size.
$requiredOn scenarios when file upload is required.
$scenarios allowed scenarios when this behavior will be used.
$types allowed file types.
$uploadPath path of the upload directory.

Защищенные свойства (Protected)

Свойство Тип Описание
$uploadManager yupe\components\UploadManager

Открытые методы

Метод Описание
addFileInstanceName ( $name )
attach ( CComponent $owner )
beforeDelete ( CEvent $event )
beforeSave ( CModelEvent $event ) : boolean
beforeValidate ( CModelEvent $event )
checkScenario ( ) : boolean Checks whether there is a current scenario in allowed scenarios.
generateFilename ( ) : string
getFilePath ( ) : mixed
getFileUrl ( ) : string
getUploadPath ( ) : string
saveFile ( ) : void. Save new uploaded file to disk and set model attribute.

Защищенные методы

Метод Описание
getUploadedFileInstance ( ) : CUploadedFile
removeFile ( ) : void. Remove previous uploaded file.

Описание методов

addFileInstanceName() публичный Метод

public addFileInstanceName ( $name )
$name string the name of the file input field.

attach() публичный Метод

public attach ( CComponent $owner )
$owner CComponent

beforeDelete() публичный Метод

public beforeDelete ( CEvent $event )
$event CEvent

beforeSave() публичный Метод

public beforeSave ( CModelEvent $event ) : boolean
$event CModelEvent
Результат boolean

beforeValidate() публичный Метод

public beforeValidate ( CModelEvent $event )
$event CModelEvent

checkScenario() публичный Метод

Checks whether there is a current scenario in allowed scenarios.
public checkScenario ( ) : boolean
Результат boolean true if current scenario is allowed.

generateFilename() публичный Метод

public generateFilename ( ) : string
Результат string generated file name.

getFilePath() публичный Метод

public getFilePath ( ) : mixed
Результат mixed

getFileUrl() публичный Метод

public getFileUrl ( ) : string
Результат string url to uploaded file.

getUploadPath() публичный Метод

public getUploadPath ( ) : string
Результат string path of the upload directory.

getUploadedFileInstance() защищенный Метод

protected getUploadedFileInstance ( ) : CUploadedFile
Результат CUploadedFile

removeFile() защищенный Метод

Remove previous uploaded file.
protected removeFile ( ) : void.
Результат void.

saveFile() публичный Метод

Save new uploaded file to disk and set model attribute.
public saveFile ( ) : void.
Результат void.

Описание свойств

$attributeName публичное свойство

attribute to store name of the uploaded file.
public $attributeName

$deleteFileKey публичное свойство

public string $deleteFileKey
Результат string

$fileInstanceName публичное свойство

the name of the file input field, used to get instance by name. Optional. If not set get instance by model attribute will be used.
public $fileInstanceName

$fileName публичное свойство

callback function to generate filename. Optional. If not set, default implementation will be used.
public $fileName

$maxSize публичное свойство

maximum file size.
public $maxSize

$minSize публичное свойство

minimum file size.
public $minSize

$requiredOn публичное свойство

scenarios when file upload is required.
public $requiredOn

$scenarios публичное свойство

allowed scenarios when this behavior will be used.
public $scenarios

$types публичное свойство

allowed file types.
public $types

$uploadManager защищенное свойство

protected UploadManager,yupe\components $uploadManager
Результат yupe\components\UploadManager

$uploadPath публичное свойство

path of the upload directory.
public $uploadPath