\UploadValidatorWrapBehavior

Class UploadValidatorWrapBehavior

UploadBehaviorのバリデータだけをwrapしたビヘイビア

Summary

Methods
Properties
Constants
setup()
isUnderPhpSizeLimit()
isUnderFormSizeLimit()
isCompletedUpload()
isFileUpload()
isFileUploadOrHasExistingValue()
tempDirExists()
isSuccessfulWrite()
noPhpExtensionErrors()
isValidMimeType()
isWritable()
isValidDir()
isBelowMaxSize()
isAboveMinSize()
isValidExtension()
isAboveMinHeight()
isBelowMaxHeight()
isAboveMinWidth()
isBelowMaxWidth()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

setup()

setup(\Model  $model, array  $config = array()) : void

SetUp Attachment behavior

Parameters

\Model $model

instance of model

array $config

array of configuration settings.

Throws

\CakeException

先にOriginalKeyが登録されてないと例外

isUnderPhpSizeLimit()

isUnderPhpSizeLimit(\Model  $model, mixed  $check) : boolean

Check that the file does not exceed the max file size specified by PHP

Parameters

\Model $model

Model instance

mixed $check

Value to check

Returns

boolean —

Success

isUnderFormSizeLimit()

isUnderFormSizeLimit(\Model  $model, mixed  $check) : boolean

Check that the file does not exceed the max file size specified in the HTML Form

Parameters

\Model $model

Model instance

mixed $check

Value to check

Returns

boolean —

Success

isCompletedUpload()

isCompletedUpload(\Model  $model, mixed  $check) : boolean

Check that the file was completely uploaded

Parameters

\Model $model

Model instance

mixed $check

Value to check

Returns

boolean —

Success

isFileUpload()

isFileUpload(\Model  $model, mixed  $check) : boolean

Check that a file was uploaded

Parameters

\Model $model

Model instance

mixed $check

Value to check

Returns

boolean —

Success

isFileUploadOrHasExistingValue()

isFileUploadOrHasExistingValue(\Model  $model, mixed  $check) : boolean

Check that either a file was uploaded, or the existing value in the database is not blank.

Parameters

\Model $model

Model instance

mixed $check

Value to check

Returns

boolean —

Success

tempDirExists()

tempDirExists(\Model  $model, mixed  $check, boolean  $requireUpload = true) : boolean

Check that the PHP temporary directory is missing

Parameters

\Model $model

Model instance

mixed $check

Value to check

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isSuccessfulWrite()

isSuccessfulWrite(\Model  $model, mixed  $check, boolean  $requireUpload = true) : boolean

Check that the file was successfully written to the server

Parameters

\Model $model

Model instance

mixed $check

Value to check

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

noPhpExtensionErrors()

noPhpExtensionErrors(\Model  $model, mixed  $check, boolean  $requireUpload = true) : boolean

Check that a PHP extension did not cause an error

Parameters

\Model $model

Model instance

mixed $check

Value to check

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isValidMimeType()

isValidMimeType(\Model  $model, mixed  $check, array  $mimetypes = array(), boolean  $requireUpload = true) : boolean

Check that the file is of a valid mimetype

Parameters

\Model $model

Model instance

mixed $check

Value to check

array $mimetypes

file mimetypes to allow

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isWritable()

isWritable(\Model  $model, mixed  $check, boolean  $requireUpload = true) : boolean

Check that the upload directory is writable

Parameters

\Model $model

Model instance

mixed $check

Value to check

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isValidDir()

isValidDir(\Model  $model, mixed  $check, boolean  $requireUpload = true) : boolean

Check that the upload directory exists

Parameters

\Model $model

Model instance

mixed $check

Value to check

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isBelowMaxSize()

isBelowMaxSize(\Model  $model, mixed  $check, integer  $size = null, boolean  $requireUpload = true) : boolean

Check that the file is below the maximum file upload size

Parameters

\Model $model

Model instance

mixed $check

Value to check

integer $size

Maximum file size

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isAboveMinSize()

isAboveMinSize(\Model  $model, mixed  $check, integer  $size = null, boolean  $requireUpload = true) : boolean

Check that the file is above the minimum file upload size

Parameters

\Model $model

Model instance

mixed $check

Value to check

integer $size

Minimum file size

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isValidExtension()

isValidExtension(\Model  $model, mixed  $check, array  $extensions = array(), boolean  $requireUpload = true) : boolean

Check that the file has a valid extension

Parameters

\Model $model

Model instance

mixed $check

Value to check

array $extensions

file extenstions to allow

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isAboveMinHeight()

isAboveMinHeight(\Model  $model, mixed  $check, integer  $height = null, boolean  $requireUpload = true) : boolean

Check that the file is above the minimum height requirement

Parameters

\Model $model

Model instance

mixed $check

Value to check

integer $height

Height of Image

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isBelowMaxHeight()

isBelowMaxHeight(\Model  $model, mixed  $check, integer  $height = null, boolean  $requireUpload = true) : boolean

Check that the file is below the maximum height requirement

Parameters

\Model $model

Model instance

mixed $check

Value to check

integer $height

Height of Image

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isAboveMinWidth()

isAboveMinWidth(\Model  $model, mixed  $check, integer  $width = null, boolean  $requireUpload = true) : boolean

Check that the file is above the minimum width requirement

Parameters

\Model $model

Model instance

mixed $check

Value to check

integer $width

Width of Image

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success

isBelowMaxWidth()

isBelowMaxWidth(\Model  $model, mixed  $check, integer  $width = null, boolean  $requireUpload = true) : boolean

Check that the file is below the maximum width requirement

Parameters

\Model $model

Model instance

mixed $check

Value to check

integer $width

Width of Image

boolean $requireUpload

Whether or not to require a file upload

Returns

boolean —

Success