FileValidatorModule class

Base class for FileValidator modules, which validate uploaded files.

To create a FileValidator module:

  1. Create a class that extends this and follow the naming convention: FileValidator[Something].
  2. Place in file: /site/modules/FileValidator[Something].module (or in module-specific directory).
  3. Copy the getModuleInfo() method out of this class and update as appropriate.
  4. Implement an isValidFile($filename) method, and you are done.

Example: /site/modules/FileValidatorHTML.module

class FileValidatorHTML extends FileValidatorModule {
    public static function getModuleInfo() {
      return array(
        'title' => 'Validate HTML files',
        'version' => 1,
        'validates' => array('html', 'htm'),
      );
    }
    protected function isValidFile($filename) {
        $valid = false;
        // some code to validate $filename and set $valid
        return $valid;
    }
}

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the FileValidatorModule class also inherits all the methods and properties of: WireData and Wire.

Show class?     Show args?       Only hookable?    

Additional methods and properties

In addition to the methods and properties above, FileValidatorModule also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.251