PHP Class yupe\components\behaviors\FileUploadBehavior

Inheritance: extends CActiveRecordBehavio\CActiveRecordBehavior
Afficher le fichier Open project: yupe/yupe Class Usage Examples

Méthodes publiques

Свойство Type Description
$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 Properties

Свойство Type Description
$uploadManager yupe\components\UploadManager

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
getUploadedFileInstance ( ) : CUploadedFile
removeFile ( ) : void. Remove previous uploaded file.

Method Details

addFileInstanceName() public méthode

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

attach() public méthode

public attach ( CComponent $owner )
$owner CComponent

beforeDelete() public méthode

public beforeDelete ( CEvent $event )
$event CEvent

beforeSave() public méthode

public beforeSave ( CModelEvent $event ) : boolean
$event CModelEvent
Résultat boolean

beforeValidate() public méthode

public beforeValidate ( CModelEvent $event )
$event CModelEvent

checkScenario() public méthode

Checks whether there is a current scenario in allowed scenarios.
public checkScenario ( ) : boolean
Résultat boolean true if current scenario is allowed.

generateFilename() public méthode

public generateFilename ( ) : string
Résultat string generated file name.

getFilePath() public méthode

public getFilePath ( ) : mixed
Résultat mixed

getFileUrl() public méthode

public getFileUrl ( ) : string
Résultat string url to uploaded file.

getUploadPath() public méthode

public getUploadPath ( ) : string
Résultat string path of the upload directory.

getUploadedFileInstance() protected méthode

protected getUploadedFileInstance ( ) : CUploadedFile
Résultat CUploadedFile

removeFile() protected méthode

Remove previous uploaded file.
protected removeFile ( ) : void.
Résultat void.

saveFile() public méthode

Save new uploaded file to disk and set model attribute.
public saveFile ( ) : void.
Résultat void.

Property Details

$attributeName public_oe property

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

$deleteFileKey public_oe property

public string $deleteFileKey
Résultat string

$fileInstanceName public_oe property

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 public_oe property

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

$maxSize public_oe property

maximum file size.
public $maxSize

$minSize public_oe property

minimum file size.
public $minSize

$requiredOn public_oe property

scenarios when file upload is required.
public $requiredOn

$scenarios public_oe property

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

$types public_oe property

allowed file types.
public $types

$uploadManager protected_oe property

protected UploadManager,yupe\components $uploadManager
Résultat yupe\components\UploadManager

$uploadPath public_oe property

path of the upload directory.
public $uploadPath