SilverStripe\Assets\Tests\UploadTest\Validator

Synopsis

class Validator extends Upload_Validator implements TestOnly {
}

Hierarchy

Extends

Implements

  • SilverStripe\Dev\TestOnly

Members

protected

  • $errors
  • $tmpFile — array
    Information about the temporary file produced by the PHP-runtime.

public

  • $allowedExtensions — array
  • $allowedMaxFileSize — array
    Restrict filesize for either all filetypes or a specific extension, with extension-name as array-key and the size-restriction in bytes as array-value.

Methods

public

  • validate() — Looser check validation that doesn't do is_upload_file() checks as we're faking a POST request that PHP didn't generate itself.

Inherited from SilverStripe\Assets\Upload_Validator

public

  • clearErrors() — Clear out all errors
  • getAllowedExtensions()
  • getAllowedMaxFileSize() — Get maximum file size for all or specified file extension.
  • getErrors() — Return all errors that occurred while validating the temporary file.
  • isFileEmpty() — Determine if this file is valid but empty
  • isValidExtension() — Determines if the temporary file has a valid extension An empty string in the validation map indicates files without an extension.
  • isValidSize() — Determines if the bytesize of an uploaded file is valid - can be defined on an extension-by-extension basis in {@link $allowedMaxFileSize}
  • isValidUpload() — Check that a valid file was given for upload (ignores file size)
  • setAllowedExtensions() — Limit allowed file extensions. Empty by default, allowing all extensions.
  • setAllowedMaxFileSize() — Set filesize maximums (in bytes or INI format).
  • setTmpFile() — Set information about temporary file produced by PHP.
  • validate() — Run through the rules for this validator checking against the temporary file set by {@link setTmpFile()} to see if the file is deemed valid or not.