Skip to content

Latest commit

 

History

History
60 lines (38 loc) · 896 Bytes

README.md

File metadata and controls

60 lines (38 loc) · 896 Bytes

FileHandler Validators

Validators used to save and upload files

FileHandlerValidator

Validator to validate uploaded and already existing files on the server.

Usage

It can be used by being declared inside the yii\base\Model::rues() method

public function behaviors()
{
    return [
        ['file', FileHandlerValidator::className()],
    ];
}

The options for this validator are

folderPath

string : '@web/'

folder to store the files.

notFoundFileName

string

error message

invalidFileName;

string

error message

notSavedFile

string

error message

fileName

callable

a PHP callable that replaces the default implementation of [[fileName()]]. The signature of the callable should be

function (
    UploadedFile $file,
    Model $model,
    FileHandlerValidator $validator
 )